Nixers Book Club - Book #6: Introduction to Operating Systems Abstractions - Community & Forums Related Discussions

Users browsing this thread: 1 Guest(s)
seninha
Long time nixers
(20-11-2021, 04:40 AM)venam Wrote: One thing that is different though are the arguments for the dd command,
they got dashes now.
In rc(1) the = character is special not only at the beginning of the command line, but in the middle too. So you can set an environment variable in the middle of the line. The UNIX dd syntax
Code:
dd if=/dev/random of=/dev/mordor
was problematic in rc(1) because of the special meaning of the equal sign.

Files

Third chapter is about files, I/O and buffered I/O using the <bio.h> header. Plan 9 also uses the concepts of file descriptors to identify the files open by a process.

The first section of this chapter introduces the basic unbuffered I/O functions (write(2) and read(2)), the functions to open/close files (open(2) and close(2)), and the function to set the file offset (seek(2)). /proc/$pid/fd lists the file descriptors that are open for process $pid (it also contains the process' cwd).

In the second section, we know that open(2) does not truncate the file by default, we should use `OTRUNC` to truncate. The file descriptor in the process' file descriptor table points to a `Chan` (channel), a structure that “contains information needed to let the kernel reach the file server and perform operations on the file”. This section also tells you that a file can have holes; it also tells about the append only permission bit.

Next sections is about the read(2) function and how to handle errors; and about the creat(2), access(2) and remove(2) functions. The next section covers directory entries, the Dir structure and functions to handle this structure.

We are introduced to globbing and, finally, at the end of the chapter, to buffered I/O.


Parent and Child

Fourth chapter deals with process creation. It introduces the functions fork(2), exec(2) and wait(2), and introduces the pitfalls of process creation (shared files, race conditions, waiting for children, etc).

Since we have bind(2) now, we do not need execp or execlp functions, the meaning of $path was diminished to a rc(1) feature. Just look at /bin.

At the end of the chapter, shell scripts and the shebang are introduced.


Messages In This Thread
RE: Nixers Book Club - Book #6: Introduction to Operating Systems Abstractions - by seninha - 20-11-2021, 11:20 AM