🧵27 questions
Multithreading
Threads, locks, executors, the memory model, deadlocks, async.
Threads & PoolsLocksvolatile & Memory ModelDeadlocksAtomicsCompletableFuture
Sample Questions (27 live)
Threads & PoolsEasy
Runnable vs Callable vs Future — how do you run a task and get its result back?
InfosysTCSCognizantRead →
Threads & PoolsEasy
What's the difference between calling thread.start() and thread.run()?
TCSInfosysWiproRead →
Threads & PoolsEasy
Walk through the thread lifecycle states — and which one signals a problem in a thread dump?
CognizantAccentureDeloitteRead →
LocksEasy
Thread.sleep() vs Object.wait() — what's the real difference?
InfosysTCSAccentureRead →
volatile & Memory ModelMedium
What does the volatile keyword guarantee, and what does it NOT?
AmazonMicrosoftDeloitteRead →
Threads & PoolsMedium
Why use an ExecutorService instead of new Thread(), and which pool type do you pick?
AmazonMicrosoftCognizantRead →
Threads & PoolsMedium
How do corePoolSize, maxPoolSize, the queue and rejection policy interact in ThreadPoolExecutor?
AmazonGoogleDeloitteRead →
LocksMedium
Why must wait() always be called in a while-loop, not an if?
AmazonMicrosoftDeloitteRead →
LocksMedium
ReentrantLock vs synchronized — when do you reach for the explicit lock?
AmazonMicrosoftGoogleRead →
DeadlocksMedium
What causes a deadlock, and how do you prevent it in a real codebase?
AmazonMicrosoftDeloitteRead →
CompletableFutureMedium
How does CompletableFuture let you compose async calls without blocking?
AmazonMicrosoftGoogleRead →
AtomicsMedium
How do Atomic classes achieve thread-safety without locks (CAS)?
AmazonGoogleMicrosoftRead →
LocksMedium
CountDownLatch vs CyclicBarrier vs Semaphore — which coordination tool when?
AmazonMicrosoftDeloitteRead →
volatile & Memory ModelMedium
What is a check-then-act race condition, and how do you fix it correctly?
AmazonGoogleDeloitteRead →
volatile & Memory ModelHard
What is the Java Memory Model and the happens-before relationship?
AmazonGoogleMicrosoftRead →
LocksHard
Why did the double-checked locking singleton need volatile to be correct?
AmazonMicrosoftGoogleRead →
AtomicsHard
What is false sharing, and how does it silently kill multi-threaded throughput?
GoogleAmazonMicrosoftRead →
DeadlocksHard
Deadlock vs livelock vs starvation — how do you tell them apart and fix each?
AmazonGoogleMicrosoftRead →
Threads & PoolsHard
How does ForkJoinPool's work-stealing work, and what's the parallel-stream pitfall?
AmazonGoogleMicrosoftRead →
DeadlocksHard
How do you diagnose high latency or a hang from a production thread dump?
AmazonMicrosoftDeloitteRead →
LocksHard
When would you reach for StampedLock's optimistic locking over ReentrantReadWriteLock?
AmazonGoogleRead →
Threads & PoolsHard
How does thread-pool exhaustion in one service cascade into a system-wide outage, and how does the bulkhead pattern prevent it?
AmazonMicrosoftDeloitteRead →
CompletableFutureMedium
thenApply vs thenApplyAsync — which thread actually runs your callback, and why does that matter?
AmazonMicrosoftGoogleRead →
Virtual ThreadsHard
Does the 'one thread per request' mental model still hold with virtual threads — and why can ThreadLocal-based caching patterns silently stop working?
AmazonGoogleRead →
Threads & PoolsHard
How does StructuredTaskScope let you treat a family of subtasks as a single unit of work?
GoogleAmazonRead →
Threads & PoolsHard
How does synchronized interact with virtual-thread carrier pinning, and how did that change in Java 24?
AmazonGoogleRead →
CompletableFutureHard
What actually happens to the underlying work when CompletableFuture.orTimeout() fires?
AmazonMicrosoftRead →
Advertisement
Google AdSense slot