Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Skill

Concurrency & Synchronization

Find race conditions and make shared-memory code correct with locks, condition variables, semaphores and atomics.

Intermediate1 roadmap

4 objectives 6 steps about 135 min

Check what you know

The lessons are coming later. The knowledge check is ready now.

Take the knowledge check

This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.

Learning objectives

  • Identify race conditions and critical sections in multithreaded code and explain why they produce nondeterministic results.
  • Protect shared state with mutexes and atomic operations, and explain how locks are built from hardware atomics and futexes.
  • Implement producer-consumer and reader-writer coordination with condition variables or semaphores.
  • Detect data races with ThreadSanitizer and reason about the cost of lock contention and lock granularity.

Lesson plan

6 steps, about 135 min · 0 of 5 lessons available so far

  1. Why counter++ breaks: interleavings, critical sections and data races Concept · 20 min · coming later
  2. Locks from the ground up: test-and-set, compare-and-swap, spinning and futexes Concept · 25 min · coming later
  3. Lab: fix a racy bank-transfer program with a mutex, then with atomics Lab · 25 min · coming later
  4. Condition variables and semaphores: the bounded buffer, step by step Worked example · 25 min · coming later
  5. Lab: hunt races with ThreadSanitizer and measure lock contention Lab · 25 min · coming later
  6. Check: spot the race, choose the primitive Knowledge check · 8 questions

Practise it

Implement a thread-safe bounded queue in C with pthread mutexes and condition variables, exercise its invariants with a multi-producer, multi-consumer stress test that runs clean under ThreadSanitizer, and report throughput for 1, 2, 4 and 8 threads. Add invariant assertions, spurious wakeups and shutdown while producers wait; explain the coverage limits of both stress testing and ThreadSanitizer.

Build it from scratch

Practice builds that exercise this skill by re-creating a real technology.

Browse 15 tutorials that practise it

References

Hard prerequisites

Unlocks

On these roadmaps

Progress and evidence for this skill are shared across all of them.