Videos: File Descriptors
slides: file-descriptor.pdf |
File descriptors are the main abstraction for interprocess communication in Unix.
- An introduction to the Unix view of files, including a file descriptor as a handle to an open file.At various points in this video, I say that /proc/cpuinfo is “not a file in the filesystem.” I mean to say that it’s “not a file that is stored on disk.” Even though the content of /proc/cpuinfo is generated on demand, it’s more precisely correct to say that it’s a file in the filesystem —
everything is a file! — and just not on disk. - An example of using the system-call API to real a file.
- An introduction and example of Unix pipes.
- Reading an EOF from a pipe and the importance of closing all write ends of a pipe.
- How a pipe’s buffer size implies that writes to a pipe must sometimes wait on reads.
- File descriptors 0, 1, and 2 as standard input, output, and error file descriptors.
- Using dup2 to change a standard file descriptor for a child process to redirect the child’s output.
- How a shell creates pipes to chain a sequence of commands in a pipeline.
- We have two libraries available for I/O: the Unix syscall API and the Standard C library. We compare the two libraries and investigate a key performance difference.
- Listing options for the buffering mode of a Standard C output file, including a discussion of the way a default mode is selected.