Concurrency & Multithreading
Threads, the Java Memory Model, locks, atomics, executors, CompletableFuture, synchronizers, deadlock, and virtual threads (Loom) — the #1 senior Java filter, from middle to senior interview depth.
01Thread Fundamentals & Lifecycle
JuniorNot started
Thread Fundamentals & Lifecycle
How to create threads, the six thread states, start vs run, daemon threads, and cooperative interruption — the vocabulary every other topic builds on.
01What are the ways to create and run a thread in Java? (Thread vs Runnable vs Callable)Junior02What is the difference between calling start() and run() on a Thread?Junior03What are the thread states in Java and how does a thread move between them?Junior02Synchronization & Intrinsic Locks
MidNot started
Synchronization & Intrinsic Locks
Race conditions, the synchronized keyword and the monitor it locks, reentrancy, and the wait/notify guarded-block protocol.
01What is a race condition? Show one and explain why it happens.Mid02How does the synchronized keyword work? What is a monitor / intrinsic lock?Mid03Synchronized method vs synchronized block — which object is locked in each case?Mid03Java Memory Model, volatile & happens-before
SeniorNot started
Java Memory Model, volatile & happens-before
The contract that makes concurrent code correct: visibility vs atomicity vs ordering, volatile, the happens-before relation, final-field semantics, and why double-checked locking needs volatile.
01What is the Java Memory Model and what problem does it solve?Senior02What does volatile guarantee — and what does it NOT guarantee?Mid03Explain the happens-before relationship. Give the main rules.Senior04Explicit Locks: ReentrantLock, ReadWriteLock, StampedLock
SeniorNot started
Explicit Locks: ReentrantLock, ReadWriteLock, StampedLock
The java.util.concurrent.locks toolbox — tryLock, fairness, Condition, read/write separation, optimistic reads, and the AbstractQueuedSynchronizer underneath.
01ReentrantLock vs synchronized — what does ReentrantLock add?Mid02What does tryLock() give you, and how does it help avoid deadlock?Mid03What is lock fairness, and what is the cost of a fair lock?Senior05Atomics & Compare-And-Swap
SeniorNot started
Atomics & Compare-And-Swap
Lock-free programming primitives: CAS, the Atomic* classes, the ABA problem, LongAdder under contention, and the VarHandle API that replaced Unsafe.
01What is compare-and-swap (CAS) and how does it enable lock-free updates?Mid02What do the java.util.concurrent.atomic classes provide?Mid03What is the ABA problem and how do you solve it?Senior06Executors & Thread Pools
SeniorNot started
Executors & Thread Pools
The Executor framework, every ThreadPoolExecutor parameter, why the Executors factory methods are dangerous in production, pool sizing, rejection policies, and graceful shutdown.
01What is the Executor framework and why use it over raw threads?Junior02Explain the core ThreadPoolExecutor parameters (corePoolSize, maximumPoolSize, queue, keepAlive).Senior03Why are the Executors factory methods (newFixedThreadPool, newCachedThreadPool) dangerous?Senior07Callable, Future & CompletableFuture
SeniorNot started
Callable, Future & CompletableFuture
Returning results from tasks and composing asynchronous pipelines: Future limitations, thenApply/thenCompose/thenCombine, the *Async variants, exception handling, and allOf/anyOf.
01Future vs Callable vs Runnable — how do they relate?Mid02What are the limitations of plain Future that CompletableFuture fixes?Mid03thenApply vs thenCompose vs thenCombine — when do you use each?Senior08Synchronizers: Latch, Barrier, Semaphore, Phaser
MidNot started
Synchronizers: Latch, Barrier, Semaphore, Phaser
The coordination toolkit: CountDownLatch, CyclicBarrier, Semaphore, Phaser, and Exchanger — what each does and how they differ.
01What is a CountDownLatch and why is it one-shot?Mid02What is a CyclicBarrier and how does it differ from a latch?Mid03What is a Semaphore and what is a typical use case?Mid09Deadlock, Livelock & Starvation
SeniorNot started
Deadlock, Livelock & Starvation
The four Coffman conditions, how to reproduce and read a deadlock in a thread dump, lock-ordering prevention, and the difference between livelock and starvation.
01What four conditions must hold for a deadlock to occur?Senior02Write code that deadlocks and explain why.Senior03How do you prevent or avoid deadlock?Senior10Thread-Safety Patterns
SeniorNot started
Thread-Safety Patterns
Designing for concurrency: what thread-safe really means, immutability, confinement, ThreadLocal and its leak risk, safe publication, and the holder idiom for lazy initialization.
01What does it mean for a class to be thread-safe?Mid02Why are immutable objects inherently thread-safe? How do you make a class immutable?Mid03What is thread confinement (and stack confinement)?Mid11Fork/Join & Parallel Streams
SeniorNot started
Fork/Join & Parallel Streams
Divide-and-conquer parallelism: the work-stealing ForkJoinPool, RecursiveTask vs RecursiveAction, the common pool trap, and when parallel streams actually help.
01What is the ForkJoinPool and how does work-stealing work?Senior02RecursiveTask vs RecursiveAction — how do you write a fork/join task?Senior03What is the common pool, and why is blocking inside it dangerous?Senior12Virtual Threads & Structured Concurrency (Loom)
SeniorNot started
Virtual Threads & Structured Concurrency (Loom)
Project Loom: how virtual threads differ from platform threads, mounting/unmounting on carriers, pinning, when to use them, and the structured-concurrency and scoped-value APIs.
01What is the difference between virtual threads and platform threads?Senior02How do virtual threads work? What are carrier threads, mounting, and unmounting?Senior03What is pinning, what causes it, and why does it hurt?Senior