POSIX system programming¶
The examples of this site come with my operating systems course, taught from 2011 to 2014 at Paris-Est Créteil University and since 2016 at ENSICAEN. Each example is a short, complete program that shows one mechanism of a POSIX system: create a process, share memory, synchronize threads, talk through a socket. Each page below describes the examples of a chapter, then shows their code. Ce site existe aussi en français.
Chapters¶
| Chapter | Topics |
|---|---|
| Processes | fork(), exec(), wait(), zombies and orphans, process groups |
| Shell scripts | Variables, substitutions, tests, loops and functions in Bash |
| Files and directories | open(), read(), write(), file offsets shared after fork(), file systems |
| Memory | Process layout, mmap(), page size |
| Synchronization | Races, mutexes, semaphores, condition variables, file locks |
| Interprocess communication | Signals, pipes, message queues, shared memory, timers |
| Sockets | TCP and UDP clients and servers, iterative and concurrent servers |
| I/O multiplexing | select() and poll() |
| Threads | POSIX threads, arguments, shared variables, detached threads |
| Various | Other examples |
| Rust examples | Some of the C examples rewritten in Rust with the nix crate |
Start with Getting started to build and run them.
The code is on GitHub, under the Apache 2.0 license.