Linux – development of low-level services and libraries (LNXPR1)

Unix-like systems, Linux - programming

On Linux and other Unix systems, applications interact with the operating system via system calls to the kernel and sometimes with shared memory. The system C library and POSIX define APIs beyond ISO C, while Linux offers extra practical extensions for performance and integration.

Interprocess communication includes POSIX and System V queues, semaphores and shared memory, plus sockets and pipes that can transfer file descriptors. Linux integrates signal handling and timer events into event loops. Languages: C, C++, Rust, Python.

THIS TRAINING COURSE WILL HELP YOU:

  • Understand how the OS works from a user-space program's perspective
  • Learn to use interprocess communication primitives on Unix systems
  • Identify Linux-specific features that simplify development beyond POSIX

WHO SHOULD ATTEND?

  • Developers of software and system tools for Linux embedded and servers
  • Library and framework authors integrating software on Unix platforms
  • Anyone interested in OS internals and user-space services

COURSE LOCATION AND AVAILABLE DATES



Public courses are usually delivered in Czech, but this course is also available in English. We can arrange private training for your team online, at your premises or in our classrooms, and tailor the content to your needs.

For groups of around 4 or more participants, private training can already be comparable in price to booking individual places on a public course. Send us your requirements and we’ll recommend the best format and provide an exact quote.

Request training in English

Course content:

Hide details
  • Operating system interface
    1. System calls (syscalls)
    2. Standard library and POSIX.1-2024
    3. Tools for tracing kernel communication
  • Errors in system calls
    1. Handling fatal and recoverable errors
    2. Handling and propagating OS errors
    3. System calls interrupted by signals
  • Communication, input and output
    1. Standard streams (stdin, stdout, stderr)
    2. File descriptors
    3. Buffered streams in C, C++ and Rust
  • Filesystem and directory structure
    1. Filesystem operations
    2. Relative paths and current working directory
    3. File permissions and attributes
  • Working with files
    1. Opening for reading or writing
    2. Hybrid approaches to file access
    3. Workarounds for lack of transactions
  • Clocks and time measurement
    1. Current time and time intervals
    2. Timer signals, events and timerfd
    3. Waiting and suspending processes (wait)
  • Process and thread management
    1. fork, exec and spawn functions
    2. Corresponding system calls
    3. Standard threads and pthreads
  • Resource sharing
    1. When using fork or clone
    2. Closing or preserving resources across exec
    3. Program return value
  • Environment and the shell
    1. Process groups and background processes
    2. System services and the service manager
    3. Combining processes started from the shell
  • Operating system tasks
    1. Difference between process and thread (LWP)
    2. Choosing between multiprocessing and multithreading
    3. Threads and processes in C, C++, Rust and Python
  • Signals and their handling
    1. Asynchronous signal handling
    2. Synchronous handling via timerfd
    3. Communication using real-time signals
  • Blocking and non-blocking communication
    1. When we don't want syscalls to sleep the process
    2. File descriptor readiness
    3. EWOULDBLOCK returned instead of blocking
  • I/O multiplexing
    1. Waiting for a set of possible events
    2. Events come from file descriptors
    3. External event-management libraries
  • Basic interprocess communication
    1. Pipes between processes (pipe)
    2. Named pipes in the filesystem (named pipe)
    3. Handling broken pipes and SIGPIPE
  • Message queues
    1. POSIX and System V variants
    2. Multiple senders and receivers
    3. In some ways more flexible than sockets
  • Local (Unix) sockets
    1. Forking processes and socketpair
    2. Local client-server architecture
    3. Socket types and their limitations
  • Network sockets
    1. Client-server architecture
    2. The Internet and TCP/IP protocol
    3. Workaround with SO_REUSEADDR
  • Connection handling strategies
    1. Forking processes or starting threads
    2. Using a pool of processes or threads
    3. Non-blocking sockets and an event queue
  • Name services
    1. Domain names and getaddrinfo
    2. glibc and /etc/nsswitch.conf
    3. Limitations, errors and alternatives
  • Memory management and mapping
    1. Dynamic memory allocation (heap, alloca)
    2. Mapping files from the filesystem
    3. Boundaries between kernel and user space
  • Shared memory
    1. Automatic for threads
    2. Explicit POSIX or System V (shm)
    3. The only communication that does not go through the kernel
  • Passing file descriptors
    1. The kernel can transfer file descriptors
    2. Can use a pipe or a local socket, for example
    3. Any file descriptor can then be sent
  • Synchronization primitives
    1. pthreads tools (mutex, condition variable)
    2. POSIX and System V semaphores and eventfd
    3. Atomic variables and lock-free operations
  • Debugging options
    1. ptrace system call
    2. Interactive debuggers like GDB
    3. Tracers like strace
  • Shared dynamic libraries
    1. Linking libraries at program start
    2. Explicit loading via dlopen
    3. Library dependencies
  • Bonus: Optimized data paths
    1. Optimized polling via epoll
    2. Zero-copy techniques in the kernel
    3. The io_uring mechanism
Prerequisites:
Good knowledge of C programming.
Recommended previous course:
Linux – Basic Administration (LNX1)
Schedule:
3 days (9:00-17:00)

Training and learning environment