Session

Linux System Programming Fundamentals

This two-day workshop provides a solid understanding of the operating system architecture and low-level interfaces (principally, system calls and library functions) that are required to build system-level applications on Linux (and UNIX) systems. By completion of the workshop, participants will have a good understanding of the construction of many common Linux and UNIX programs (e.g., the shell, ls(1), and cp(1))

Topics

(+) Topics marked with a plus sign will be covered as time permits.

1. Fundamental concepts
* System calls and library functions
* Error handling
* System data types

2. File I/O
* File descriptors
* I/O system calls: open(), close(), read(), write()
* Seeking to a file offset: lseek(); file holes
* Relationship between file descriptors and open files
* Duplicating file descriptors
* Open file status flags
* I/O buffering in stdio and the kernel

3. File attributes
* Retrieving file information: stat()
* File ownership and permissions
* Changing file attributes

4. Directories and links (+)
* Hard and soft (symbolic) links
* Directories
* Current working directory
* System calls and library functions for working with directories and links

5. Processes
* Process ID and parent process ID
* Memory layout of a process
* Command-line arguments
* Environment list

6. Process Credentials
* Password and group file
* User and group IDs
* Process credentails: real and effective IDs; supplementary group IDs
* Retrieving process credentials

7. Signals
* Signal types and default actions
* Setting signal dispositions
* Signal handlers
* Blocking signals (the signal mask); pending signals
* Designing signal handler functions
* Reentrant and async-signal-safe functions

8. Process lifecycle
* Process creation: fork()
* File descriptors and fork()
* Process termination: exit(3) and _exit(2)
* Monitoring child processes: wait(), waitpid()
* Orphans and zombies
* The SIGCHLD signal

9. Executing programs
* Executing a program: execve()
* The exec() library functions
* File descriptors and exec()

10. Privileged programs (+)
* Set-user-ID and set-group-ID programs
* Changing process credentials

11. Using pipes and FIFOs for interprocess communication (+)
* Creating and using pipes
* Using pipes to connect filters
* FIFOs
* Semantics of I/O on pipes and FIFOs

Audience

The following people are likely to find the workshop of particular benefit:
* Programmers developing system-level applications for Linux systems, or programmers porting such applications from other operating systems (e.g., Windows) to Linux.
* Embedded programmers developing applications for Linux, or porting embedded applications from systems such as VxWorks or QNX to Linux.
* DevOps engineers and sytem administrators who want to gain a greater insight into the oepration of Linux applications.

Format

The workshop consists of a mixture of detailed presentations coupled with many coding exercises that allow participants to apply the knowledge learned in the presentations.

Prerequisites

* You should have a good reading knowledge of C or C++. For the practical sessions, templates will be provided to relieve you of the need to type in tedious boilerplate code. The templates are in C, but if you wish, it is also possible to complete the exercises in another suitable language such as D, Rust, or of course C++.
* You should have a basic familiarity with the Linux/UNIX command line to do tasks such as listing directories, editing files, and compiling programs.
* No previous system programming experience is assumed.

Computer Setup

You'll need a laptop with Linux installed--either as a native install or inside a virtual machine (VM). In the latter case, you should ensure that the VM has working Internet access. The system should have a C compiler (e.g., gcc) and "make" installed. (It's likely that both of these are provided as part of the default install, if you are setting up a new system.)

Michael Kerrisk

Trainer/author/programmer

View Speaker Profile

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top