Advanced Programming in the UNIX Environment (MOOC notes)

Notes for the course on Advanced Programming in the UNIX Environment by Stevens Institute of Technology. Systems programming, the UNIX development environment -syscalls, shell commands- and a little bit of UNIX history. I am currently doing this MOOC so the notes are kind of raw so far.

Course Syllabus - YouTube Playlist.

Facts section

Man pages: Section 2 for calls, 3 for library functions.

strerror turns error codes into string description.

File I/O

Optimal buffer size for big file I/O operations -imagine using write in chunks, for instance- matches the filesystem’s block size. You can obtain this for a given file by running stat -f "%k" $FILENAME.

Relevant syscalls: open, creat, close, read, write, lseek.

File Sharing: process table -> file table -> v-node table (each has pointers to entries in the next). dup Allows to have a process table entry that points to the same file file table entry with two different file descriptors, allowing for the creation of, among other things, pipes.

Stdin, out or err can be represented as devices (/dev/std{in,out,err}) which can be referenced in any bash commands etc. Alternatively they can be mentioned as /dev/fd/{0,1,2}

Interesting man pages

Consistency underlies all aspects of quality.
- Frederick P. Brooks, Jr.

Process time is measured in clock ticks, and includes three values:

Standard way to create a process: fork, exec and wait.

Interesting UNIX programs / Bash commands

[Share on twitter]

01 Nov 2022 - importance: 3