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. Introduction

    2. Fundamental Concepts
    * System calls and library functions
    * Error handling
    * System data types
    * Notes on code examples

    3. File I/O and Files
    * File I/O overview
    * open(), read(), write(), and close()
    * The file offset and lseek()
    * Relationship between file descriptors and open files
    * Duplicating file descriptors
    * File status flags (and fcntl())
    * Retrieving file information: stat()

    4. Processes
    * Process IDs
    * Process memory layout
    * Command-line arguments
    * The environment list
    * The /proc filesystem

    5. Signals
    * Overview of signals
    * Signal dispositions
    * Useful signal-related functions
    * Signal handlers
    * Signal sets, the signal mask, and pending signals
    * Designing signal handlers

    6. Signals: Signal Handlers
    * Async-signal-safe functions
    * Interrupted system calls
    * SA_SIGINFO signal handlers
    * The signal trampoline (+)

    7. Process Lifecycle
    * Creating a new process: fork()
    * Process termination
    * Monitoring child processes
    * Orphans and zombies
    * The SIGCHLD signal
    * Executing programs: execve()

    8. System Call Tracing with strace (+)
    * Getting started
    * Tracing child processes
    * Filtering strace output
    * System call tampering
    * Further strace options

    9. Pipes and FIFOs
    * Creating and using pipes
    * Connecting filters with pipes
    * FIFOs (+)

    10. 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

    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
    man7.org

    Michael Kerrisk is a trainer, author, and programmer who has a passion for investigating and explaining software systems. He is the author of "The Linux Programming Interface", a widely acclaimed book on Linux (and UNIX) system programming. He has been actively involved in the Linux development community since 2000, operating mainly in the area of testing, design review, and documentation of kernel-user-space interfaces. Since 2004, he has maintained the Linux "man-pages" project, which provides the primary documentation for Linux system calls and C library functions. Michael is a New Zealander, living in Munich, Germany, from where he operates a training business (man7.org) providing low-level Linux programming courses in Europe, North America, and occasionally further afield.

    Programutvikling uses cookies to see how you use our website. We also have embeds from YouTube and Vimeo. How do you feel about that?