Nixers Book Club - Book #6: Introduction to Operating Systems Abstractions - Community & Forums Related Discussions
Users browsing this thread: 3 Guest(s)
|
|||
Chapter 5 covers the basic IPC mechanisms for Plan 9. It begins with
IO redirection on rc (with the < and > operators) and on C (with dp(2)). Redirection of one file descriptor to other other is much more different on Plan 9. ">[1=2]" vs "1>&2". Pipe is also explained both in rc(1) (which works like in UNIX sh(1)) and in C (with pipe(2)). rc(1) has <{}, a very useful construct that runs the command between braces and expands to a pipe file with the output of that command. Bash already does that with <(), but that's not in POSIX sh(1). Plan 9 replaces UNIX signals with notes, which are strings "posted" into a process' `/proc/$pid/note` file. The chapter illustrates this mechanism with a program that prints the note that are posted into it. It also introduces alarm(2), that posts a note containing `alarm` to the process after some time has been passed. The `ORCLOSE` flag for open(2) is then introduced. I wish UNIX had that! With this flag, you do not need a signal handler to cleanup files after the program is terminated. The next session is about the /srv file descriptor bulletin board. Apparently, that's plan 9 weird but interesting way to implement named pipes. Chapter 6 is about networking and how it is represented in the file system. I read this chapter some weeks ago but I have not wrote any notes about it... So here's what I remember. Through the chapter we design a simple echo server that we can use from our Plan 9 machine. I used it to communicate between my Plan 9 guest system to my host system. At the end of the chapter we see how Plan 9 offers a simpler echo service using only cat(1) (in a secript at /rc/bin/service/tcp7). The way connections are controlled using writing into control files was new to me. |
|||