Embedded Linux System Programming
A practical program that takes you from your first fork() to a Linux kernel you cross-compile and boot yourself. Every concept is drawn on the whiteboard, coded live in C and run on Linux: processes, IPC, POSIX threads, timers, daemons, epoll, namespaces and cgroups, multithreading design patterns, and finally an ARM64 kernel, a BusyBox root file system and your own driver on QEMU.
▶ Watch the 40-second preview: turn on the sound with the speaker icon
Who is it for?
Profile
- Embedded engineers moving from microcontrollers / RTOS to Linux
- C developers who want to write robust multi-process and multi-threaded applications
- Final-year students and PFE / internship candidates
- Engineers preparing for embedded Linux, automotive or IoT positions
Prerequisites
- C programming (pointers, structs, memory)
- Basic command-line usage
- A PC with Linux, or Windows with WSL (Ubuntu)
- No prior Linux system programming experience needed
What you will be able to do
- Explain how Linux runs your program: user space, kernel space, system calls and the scheduler
- Create and manage processes and choose the right IPC: pipes, message queues, shared memory, semaphores, sockets
- Write correct multi-threaded code with pthreads: mutexes, condition variables, barriers, no races and no deadlocks
- Understand what the CPU does to your threads: caches, memory ordering, false sharing
- Build event-driven services with timers, epoll and inotify, and run them as systemd daemons
- Isolate and limit applications with namespaces, cgroups and Docker
- Apply multithreading design patterns: thread pool, producer / consumer, task queue
- Cross-compile a Linux kernel and BusyBox for ARM64, boot it on QEMU and add your own kernel module
Detailed program
Each session mixes whiteboard theory, live coding and labs. Open a session to see its content.
Module 1: Linux and processes
Weekend 1Understand how Linux runs programs, and master the process model.
01Linux foundations and the process modelKernel vs user space, system calls, fork() and wait()▶
Theory
- Linux architecture: kernel, user space, system calls
- Program vs process; the process life cycle and states
- Process creation with
fork(): what the child inherits - Parent / child synchronization with
wait()andwaitpid() - Exit status, zombies and orphans
- Reading the man pages as your first reference
Labs
- Set up the Linux / WSL development environment, GCC and VS Code
- Create a child process and print the PIDs
- Wait for a child and decode its exit status
- Observe processes with
psand/proc
fork().02Processes in depth and first IPCexec, environment, signals, pipes▶
Theory
- The
execfamily and the program's environment - Foreground and background processes, sessions and process groups
- Signals: sending, handling and masking
- Inter-process communication overview
- Pipes and FIFOs: byte streams between processes
Labs
- Launch a program with
fork()+exec() - Install a signal handler
- Parent / child communication through a pipe
Module 2: Inter-process communication and POSIX threads
Weekend 2Choose the right IPC mechanism, then move to multi-threading and its pitfalls.
03Inter-process communicationPipes, message queues, shared memory, semaphores, sockets▶
Theory
- IPC families: byte stream, message oriented, shared memory
- Pipe capacity, blocking behavior and atomic writes (
PIPE_BUF) - POSIX message queues: attributes, priorities, blocking and non-blocking mode
- POSIX shared memory and memory mapping
- Binary and counting semaphores
- Sockets: Unix domain and network sockets, client / server life cycle
- Introduction to threads
Labs
- Producer / consumer with a POSIX message queue
- Share data between two processes with shared memory + a semaphore
- Unix domain socket server and client
- Inspect IPC objects in
/dev/mqueueand/dev/shm
04POSIX threads and synchronizationpthreads, mutexes, deadlocks, condition variables, barriers▶
Theory
- Why multi-threading: synchronous vs asynchronous, multi-core CPUs, Amdahl's law
- The pthreads API: create, join, detach, return values
- The different ways a thread terminates; cancellation
- Race conditions and mutexes
- Deadlocks and
pthread_mutex_trylock - Condition variables, signals and threads
- Barriers
- Introduction to thread pools and CPU / I/O bound workloads
Labs
- Create, join and detach threads; pass and return data
- Reproduce a race condition, then fix it with a mutex
- Reproduce a deadlock, then avoid it
- Waiter / updater threads with a condition variable
- Synchronize worker threads with a barrier
Module 3: Linux services and system internals
Weekend 3Build real Linux services, then look under the hood: containers, CPU and memory.
05Time, timers, daemons and I/O multiplexingClocks, POSIX timers, systemd, epoll, inotify▶
Theory
- Multi-threaded application architecture
- Time on Linux:
CLOCK_REALTIMEvsCLOCK_MONOTONIC, real / user / sys time - Timers: signal-based POSIX timers and
timerfd - Daemons: how to write one, and logging with syslog
- systemd: units, service life cycle, dependencies
- File I/O buffering: the stdio buffer and the kernel page cache
- I/O models: blocking, non-blocking and multiplexed (
epoll) - Monitoring file events with
inotify
Labs
- Measure elapsed and CPU time correctly
- Periodic task with a POSIX timer and with
timerfd - Write a daemon and run it as a systemd service
- Event loop serving several clients with
epoll - Watch a configuration file with
inotify
06Containers and what the CPU does to your threadsNamespaces, cgroups, Docker, caches, memory ordering▶
Theory
- Namespaces: mount, IPC, network and PID; how PIDs look inside and outside
- cgroups: limiting CPU, memory and I/O
- Docker: virtual machines vs containers, Dockerfile, image, container
- The history of parallel CPUs: pipelines, superscalar, out-of-order, multi-core, hyper-threading
- CPU topology and cache hierarchy
- Memory consistency: sequential consistency, store buffers, reordering, memory barriers
- Cache lines and false sharing
Labs
- Create namespaces and compare PIDs from both sides
- Limit a process with a cgroup
- Package and run your server in a Docker container
- Read the CPU topology from
/sys - Show reordering and false sharing in code, then fix them
Module 4: Design patterns, tooling and the Linux kernel
Weekend 4Structure real applications, debug and build them professionally, then go down to the kernel.
07Debugging, CMake and multithreading design patternsgdb, VS Code, CMake, thread pool, producer / consumer, scheduler▶
Theory
- Linux history and the GNU ecosystem
- Debugging with gdb and VS Code; build tasks
- CMake: a meta-build system, configure and build
- Design patterns: thread per task vs thread pool
- Task queue and thread pool implementation
- Producer / consumer with condition variables, without polling
- The Linux scheduler: CFS,
SCHED_OTHER,SCHED_BATCH,SCHED_FIFO,SCHED_RR - I/O-bound, CPU-bound and memory-bound workloads: choosing a policy
Labs
- Debug a multi-threaded program step by step in VS Code
- Turn a project into a CMake build
- Implement a thread pool with a task queue
- Producer / consumer on a shared circular buffer
- Run threads with real-time scheduling policies
08Embedded Linux on ARM64: kernel, root file system and driversCross-compilation, BusyBox, QEMU, kernel modules▶
Theory
- Project review: multi-threaded architecture and code
- The embedded Linux stack: bootloader, kernel, root file system, applications
- Cross-compilation and the
aarch64toolchain - Configuring and building the Linux kernel for ARMv8
- BusyBox and building a minimal root file system / initramfs
- Kernel modules and character drivers:
file_operations,copy_to_user,copy_from_user - System calls: from user space into the kernel
Labs
- Get and build the Linux kernel and BusyBox for ARM64
- Boot your own Linux on QEMU
- Write, build and load a character driver
- Talk to your driver from a user-space application
- Cross-build an application and run it on the QEMU target
From system calls to the kernel
The program goes from user space down to the kernel, one layer at a time:
Tools
Environment
- Linux (Ubuntu) or Windows with WSL
- QEMU emulating an ARM64 (ARMv8) board: no hardware to buy
Software
- GCC, the
aarch64-linux-gnucross toolchain, Make and CMake - VS Code, gdb, Git and GitHub
- systemd, Docker, BusyBox, Linux kernel sources
What's included
- 8 live sessions with the trainer
- All lab sources on GitHub
- Slides and lab companion sheets
- Live Q&A in every session
Registration open: session starting 9 January 2027
Hybrid: on site in El Ghazala or online. Limited seats. A question about the prerequisites? Book a free 30-minute call.
Trainer: Mehdi Hanzouti, Embedded SW Architect · contact@opcode-labs.com
// registration
Book your seat
Fill in this form to register for the session starting 9 January 2027. You get a confirmation email straight away, then we contact you to finalise your registration.
Your data is only used to handle your registration. Any question? +216 92 999 707 · contact@opcode-labs.com