Course in POSIX Threads using C

Course in POSIX Threads using C Programming

Bugs in multi-threaded programs are often considered to be the most troublesome issus to get as a programmer. In fact the general rule is to not put them there from start.

If one think that this advise is unrealistic, then the next best advise is to code according to a well-proven set of idioms, which avoid the problems. In this course, we focuses on precisely that strategy.

This is what you will learn
  • Writing multi-threaded programs using POSIX Threads C API
  • Program using C11 Threads
  • Understand and know how to deal with classical concurrency problems
  • Handle mutex locks and condition variables
  • Using semaphores
  • Handle atomic variables
Course Contents

Introduction to Threads and Concurrency

  • Current vs. parallel
  • Scheduling
  • Synchronization
  • Virtual adress space organization
  • Overview of how a function-call is performed and why it's relevant to threads

POSIX Threads

  • Overview of the POSIX Threads C API
  • Creating a thread
  • Passing paramaters to a new thread
  • Configuring threads, like setting the stack-size

The Critical Section Problem

  • Understanding the problem and its solution
  • Three conditions for the critical-section problem
  • POSIX mutex variables
  • Configuration
  • Avoiding self-deadlock
  • Adapting for shared memory

The Race-Condition Problem

  • Understanding the problem and its solution
  • POSIX condition variables
  • Configuration
  • Handling timeouts
  • Adapting for shared memory
  • Understanding monitor semantics
  • The minimum amount of code to safely transfer data from one thread to another

The Deadlock Problem

  • The concept resource
  • Understanding the problem and its solution
  • Four conditions for the deadlock problem
  • Preventing deadlocks
  • Detection of deadlocks

Synchronization and Other Data-Types

  • Read/Write locks
  • Barriers
  • Thread-local storage


  • POSIX semaphores
  • Memory-based vs. file-based semaphores

A C11 Primer

  • Evolution of the C languages
  • C11 highlights
  • Type-generic macros
  • Anonymous structs and unions
  • Static assertions
  • Bounds-checking support

C11 Threads

  • Overview and background of C11 Threads
  • How C11 Threads differs from POSIX Threads
  • Creating threads in C11
  • Waiting for thread termination
  • Mutex variables
  • Condition variables
  • Thread specific data
  • Atomic (lock-free) variables
  • Lock free atomic operations
NamePOSIX Threads using C
Duration 2 Days
AudienceTechnical C programmers
Prerequisites Practical knowledge and experince of C programming
  • GCC compiler
  • Jetbrains CLion IDE
  • Ubuntu Linux @ VirtualBox or WSL @ Windows-10
Course Dates
2020-02-20Stockholm15 000 kr
2020-03-12Stockholm15 000 kr
2020-04-02Stockholm15 000 kr
2020-04-27 Stockholm15 000 kr
2020-05-18Stockholm 15 000 kr

Same-Company Discout

We offer a 20% discount for additional participants from the same company and at the same course date. Read more here.

Teaching Language

Our printed course material is always authored in English. The oral presentation in our classrooms is generally in Swedish, unless all participants agree to that we perform the course in English.

On-Site Course

If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

Read more about out price modell and term of sales here.

Related Courses
C Programming4 BeginnerShow
Linux Systems Programming using C3AdvancedShow
Threads Programming using Modern C++3AdvancedShow