Linux/UNIX System Programming course outline
"Standard" Topics
(See below for a list of alternative topics)
- Course Introduction
- Fundamental Concepts
- System calls and library functions
- Error handling
- System data types
- Notes on code examples
- File I/O
- File I/O overview
- open(), read(), write(), and close()
- File I/O Buffering
- Kernel buffering
- User-space (stdio) buffering
- Controlling kernel buffering
- File I/O: Further Details
- The file offset and lseek()
- Atomicity
- Relationship between file descriptors and open files
- Duplicating file descriptors
- File status flags (and fcntl())
- Files
- Inodes
- Retrieving file information: stat()
- File mode
- Changing file attributes
- Directories and Links (*)
- Directories and (hard) links
- Symbolic links
- Hard links: system calls and library functions
- Symbolic links: system calls and library functions
- Current working directory
- Operating relative to a directory (openat() etc.)
- Scanning directories
- Processes
- Process IDs
- Process memory layout
- Command-line arguments
- The environment list
- Process credentials
- Process groups and sessions (*)
- Nonlocal gotos
- Signals
- Overview of signals
- Signal dispositions
- Useful signal-related functions
- Signal handlers
- Signal sets, the signal mask, and pending signals
- Designing signal handlers
- Signals: Signal Handlers
- Async-signal-safe functions
- Interrupted system calls
SA_SIGINFO
signal handlers
- The signal trampoline (*)
- Process Creation and Termination
- Creating a new process: fork()
- File descriptors and fork()
- Process termination
- Monitoring child processes
- Orphans and zombies
- The
SIGCHLD
signal
- PID file descriptors
- Executing Programs
- Executing programs: execve()
- The exec() library functions
- File descriptors and exec()
- Process attributes during fork() and exec()
- System Call Tracing with strace (*)
- Getting started
- Tracing child processes
- Filtering strace output
- Threads: Introduction
- Overview of threads
- Pthreads API basics
- Thread creation and termination
- Thread IDs
- Joining and detaching threads
- Thread attributes
- Signals and threads
- Threads and process control
- Threads: Synchronization
- Shared resources and critical sections
- Mutexes
- Locking and unlocking a mutex
- Condition variables
- Signaling and waiting on condition variables
- Further details on signaling condition variables
- Dynamically initialized synchronization primitives
- Other synchronization primitives
- IPC: Introduction and Overview (*)
- Categorizing IPC
- Choosing an IPC mechanism
- Pipes and FIFOs
- Creating and using pipes
- Connecting filters with pipes
- FIFOs
- Sockets: Concepts and UNIX Domain
- Socket types and domains
- Creating and binding a socket
- System calls: stream sockets
- UNIX domain stream sockets
- System calls: datagram sockets
- UNIX domain datagram sockets
- Further details of UNIX domain sockets
- Sockets: Internet Domain
- Internet domain sockets
- Data-representation issues
- Loopback and wildcard addresses
- Host addresses and port numbers
- Host and service conversion
- Internet domain sockets example
- Additional sockets system calls
- Alternative I/O Models
- Nonblocking I/O
- Signal-driven I/O
- I/O multiplexing: poll()
- Event-loop programming
- Alternative I/O Models: epoll
- Problems with poll() and select()
- The epoll API
- epoll events
- Edge-triggered notification
- epoll API quirks
- POSIX Semaphores
- Named semaphores
- Semaphore operations
- Unnamed semaphores
- POSIX Shared Memory
- Creating and opening shared memory objects
- Using shared memory objects
- Synchronizing access to shared memory
(*) Topics marked with an asterisk will be covered subject to time
constraints.
Return to the course overview
Alternative topics
For tailored onsite courses,
various alternative topics can, by previous arrangement,
be substituted into the list above.
Alternative topics include:
- Topics from the course,
Building and Using Shared Libraries on Linux
- Topics from the course,
Linux Security and Isolation APIs
- System V IPC
- Message queues
- Shared memory
- Semaphores
- File Locking
- Overview
- BSD file locks
- POSIX record locks
- POSIX record locks: lock inheritance and release
- Open file description locks
- Further details on locking APIs
- Memory mappings
- Overview
- Private file mappings
- Shared file mappings
- Anonymous mappings
- Swap space overcommitting
- Inotify
- The inotify API
- Reading inotify events
- Example program
- Limits
- Notes and caveats
- Extended Attributes
- Access Control Lists
- Overview
- Shell commands
- API overview
- Login Accounting
- Overview of login accounting
- The utmp and wtmp files and utmpx records
- The utmpx API
- The lastlog file
- Pluggable Authentication Modules (PAM)
- Overview of PAM
- PAM configuration files
- PAM configuration file example
- PAM APIs
- Secure programming
- Overview of common attacks
(stack smashing, format string attacks, other attacks)
- Mitigations and hardening options
- A checklist for writing safe and robust programs
- SELinux
- Introduction
- The problem of DAC; the solution from MAC
- SELinux status
- Security contexts (labels)
- Rules and policy
- Logging
- File security contexts
- Process security contexts
- When it all goes wrong
- SELinux booleans
- Comparison with seccomp
- Further details
- The memfd API
- memfd_create()
- File sealing; file sealing use cases
- Other uses for memfd
- Process Priorities and Scheduling
- Process priorities (nice values)
- Autogrouping
- Overview of realtime process scheduling
- Realtime process scheduling API
- Additional Linux scheduling policies
- CPU affinity
- Process groups, sessions, and job control
- Terminals
- Overview
- Fetching and changing terminal attributes
- Terminal special characters and flags
- Canonical and noncanonical modes
- Terminal window size
- Terminal identification
- Pseudoterminals
- Overview
- Pseudoterminal APIs
- Building some useful functions
- Pseudoterminal I/O
- An example application: script(1)
- GDB
- Introduction
- Getting started
- Single-stepping and viewing source code
- TUI mode
- Breakpoints
- Printing, modifying, and watching variables
- Scripts and user-defined commands
- Working with the stack
- Examining memory
- Automatic displaying
- Machine-language instructions
- Other GDB features
- Time
- Overview
- Calendar time
- Elapsed time
- Process time
- Timers and Sleeping
- Historic timer APIs
- POSIX timers
- POSIX timers: notification
- POSIX timers: notification via signals
- POSIX timers: timer overruns
- POSIX timers: notification via threads
- POSIX timers:
/proc/PID/timers
- The timerfd API
- Sleeping
- Threads: Thread-Specific Data
- Thread safety and reentrancy
- Thread-specific data: introduction
- Thread-specific data APIs
- Thread-specific data example
- Thread-local storage
- Building programs with Make
- An overview of the GNU C compiler
- Free software licenses
- BSD/MIT
- Apache 2
- GPL
- LGPL
Return to the course overview