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(), close()
- The file offset and lseek()
- Atomicity
- Relationship between file descriptors and open files
- Duplicating file descriptors
- File status flags (and fcntl())
- File I/O Buffering
- Kernel buffering
- User-space (stdio) buffering
- Controlling kernel buffering
- Files
- Inodes
- Retrieving file information: stat()
- File mode
- Changing file attributes
- Directories and Links
- Directories and (hard) links
- Symbolic links
- 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 groups and sessions (*)
- Nonlocal gotos
- Process Credentials
- Users and groups
- Process credentials
- Retrieving process credentials
- Signals: Introduction
- Signal dispositions
- Signal handlers
- Useful signal-related functions
- 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 (*)
- Signals: Further Details (*)
- Sending signals from a program
- Realtime signals
- Further signal APIs
- Process Creation and Termination
- Creating a new process: fork()
- File descriptors and fork()
- Process termination
- Monitoring child processes
- Orphans and zombies
- The
SIGCHLD
signal
- Exit handlers (*)
- Executing Programs
- Executing programs: execve()
- The exec() library functions
- File descriptors and exec()
- System Call Tracing with strace
- Getting started
- Tracing child processes
- Filtering strace output
- Privileged Programs
- Process credentials
- Set-user-ID and set-group-ID programs
- Changing process credentials
- Threads: Introduction
- 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
- Dynamically initialized mutexes
- Dynamically initialized condition variables
- 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()
- Problems with poll() and select()
- The epoll API
- epoll events
- epoll: edge-triggered notification
- epoll: API quirks
- Event-loop programming
- POSIX IPC Overview
- POSIX Semaphores
- Named semaphores
- Semaphore operations
- Synchronizing access to a shared resource
- Unnamed semaphores
- POSIX Shared Memory
- Creating and opening SHM objects
- Using SHM objects
- Synchronizing access to SHM
- POSIX Message Queues (*)
- Opening, closing, and unlinking a message queue
- Message queue attributes
- Sending and receiving messages
- The mqueue filesystem
- Message queue limits and defaults
- Message notification via a signal
- Message notification via a thread
- Daemons (*)
- Creating a daemon
- Reinitializing a daemon
(*) 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