C Language – Threads and Asynchronous I/O (C4)
Programming, C, C++
Practical course focusing on concurrency in C: from classical threads and mutexes to atomic operations, lock-free algorithms and shared memory handling. It explains the C memory model and common errors such as data races, inconsistencies and deadlocks, with mitigation strategies.
The course also covers event-driven design, non-blocking I/O and designing asynchronous APIs with callbacks and state machines to combine computation, communication and hardware handling efficiently. It is updated for C23, focused on embedded and Unix systems, and can be customized.
Location, current course term
Contact us
The course:
Hide detail
-
Threads and processes
-
Threads as defined by C11
-
Processes on POSIX platforms
-
UNIX and the reluctance to use threads
-
Multithreaded memory model
-
Concurrency access issues
-
The happens-before relationship
-
Accessing shared data
-
Thread synchronization
-
Locks and critical sections (mutex)
-
Condition variables and signaling
-
Locking issues and deadlocks
-
Unix system facilities
-
Semaphores and message queues (POSIX, System V)
-
Shared memory (POSIX, System V)
-
Priority inheritance (pthreads)
-
Atomic operations
-
Lock-free synchronization
-
Memory ordering and hardware barriers
-
Passing results between threads (acquire/release)
-
Lock-free data structures
-
Applying atomics (CAS)
-
Algorithm properties (lock-free, wait-free)
-
The ABA problem
-
Callbacks
-
Function pointers and context (callbacks)
-
Recursive and deferred callbacks
-
Emulating lambdas from higher-level languages
-
State-based event processing
-
State machines with progress information
-
Cooperative interruption of activities
-
Emulating coroutines and cooperative tasks
-
Event loop
-
Event-driven software
-
Registration and chaining of callbacks
-
Waiting for groups of events (select)
-
Non-blocking I/O
-
OS support
-
Enables custom cooperative scheduler
-
Implementing an asynchronous scheduler
-
Principles of asynchronous I/O
-
Integrating scheduler and I/O
-
Computation versus communication
-
Interaction with multithreading
-
Asynchronous network communication
-
Communication over TCP/IP
-
HTTP server and client
-
Concurrency with other operations
-
Embedded and hardware communication
-
Serial line communication
-
Local communication channels
-
Interaction with the operating system
-
Bonus: Cross-platform libraries
-
libevent
-
libuv
-
libev
-
libcurl
-
Mongoose
-
Assumed knowledge:
-
Good knowledge of C programming.
-
Recommended previous course:
-
C Language — Practical Advanced Programming (C2)
-
Schedule:
-
3 days (9:00 AM - 5:00 PM )
-
Language:
-