Pattern

Concurrency

Coordinate threads sharing state so nothing is lost, no one deadlocks, and no one spins burning CPU while waiting.

What it is

Concurrency problems ask you to build a small, correct piece of shared infrastructure — a bounded queue, a counter, a rate limiter, a reader-writer lock — that many threads use at once, using locks, condition variables, or semaphores as your only primitives. The core skill is distinguishing what must be atomic (a check-then-act sequence, an increment) from what can genuinely run in parallel (independent reads), and expressing "wait until this condition becomes true" without a thread ever burning CPU in a polling loop. Correctness here is usually provable in a few specific properties — no lost update, no double-wake, no starvation — that the interviewer will test by naming an interleaving, not by reading your code line by line.

When it applies

Tells in the problem

The classic mistake

A check-then-act race hides in code that protects the read and the write of shared state with a lock separately, but leaves the decision in between un-protected — checking if queue is full under one lock acquisition and then appending under a second one, with another thread's put or get sliding in between the two and invalidating the check. It slips through because both halves look locked when read individually; the bug only shows up under real contention, never in a single-threaded test. Guard against it by identifying the smallest span of code where the check and the action must be seen as one atomic unit, and holding one lock (or one condition-variable wait) across that entire span, not just around each half.

Questions to start with

All 6 concurrency questions

Problem statement, examples and hints are free on every page; the worked approach, solution and tests are in the company guides.

Free starter pack

13 must-tier questions with full solutions

Sign in with an email — no purchase — and read them in the full reader.

No password, no spam. One sign-in email; you can read the pack in the full reader.