Command Palette

Search for a command to run...

Roadmap
Phase 5Advanced7 of 19 in the curriculum

Concurrency for LLD

Threads, locks, pools and the four shared-state bugs every LLD hides.

Almost every LLD problem in Phase 4 has a concurrency trap: two threads mutating a shared collection. This phase gives you the Java vocabulary to name the trap and the fix.

Interview rule: when a design mutates shared state, you must volunteer the synchronization strategy before you're asked.

0/11 · 0%
11 topics ~71 min 11 code blocks & diagrams
Start with the first topic
1
5.1

Java Concurrency Primitives

Thread, Process, Runnable, Callable, Future — the units and handles of concurrent work.

6 min 1 code practice

2
5.2

Synchronization and Locks

synchronized, volatile, Lock, ReentrantLock, ReadWriteLock — the mechanisms, and critically, what each one is (not) for.

7 min 1 code practice

3
5.3

Concurrent Data Structures / Atomics

AtomicInteger, AtomicLong, ConcurrentHashMap, BlockingQueue — the toolbox that removes most manual locking.

6 min 1 code practice

4
5.4

Thread Pools

ExecutorService, ThreadPoolExecutor, its queue, worker threads and rejection policy — the operational half of concurrency.

7 min 1 diagram 1 code practice

5
5.5

Race Conditions

Two threads interleave on shared state and the result depends on timing — the bug class every LLD question secretly tests.

7 min 1 diagram 1 code practice

6
5.6

Deadlocks

Thread A holds lock 1 and wants lock 2; thread B holds lock 2 and wants lock 1 — both wait forever.

6 min 1 diagram practice

7
5.7

Locks vs Atomics

The performance/readability trade: when to use synchronized/locks vs CAS atomics.

6 min practice

8
5.8

Producer / Consumer

The fundamental async pattern: producers enqueue, consumers dequeue — decoupling, back-pressure, and rate mismatch handling.

7 min 1 diagram 1 code practice

9
5.9

Thread-safe Singleton

Phase 2's singleton, now graded under concurrency: the four safe forms and why naive lazy init crashes with two threads.

6 min practice

10
5.10

Concurrent Rate Limiter

Applying everything in this phase to the limiter: per-key state, atomic claims, and the shared-map granularity decision.

6 min practice

11
5.11

Concurrent Cache

Building the Phase 10 cache-aside in-process first: thread-safe read/write, single-flight, and eviction under concurrency.

7 min 1 code practice