Language-Level Concurrency and Multithreading Questions

Per-language and per-runtime concurrency: the threading and async APIs each language and platform provides (goroutines, channels, worker pools and pipelines in Go, threads, executors, ThreadPoolExecutor tuning and CompletableFuture in Java, Kotlin coroutines, dispatchers, Flow and structured concurrency, Swift GCD with queues and QoS, DispatchGroup, OperationQueue, actors and async/await, Android Handler/Looper, HandlerThread and thread pools, Flutter isolates, C++ std::thread and atomics, Python threads versus multiprocessing versus asyncio tasks, gather and graceful shutdown), each language's memory model and visibility guarantees (Java happens-before and volatile, C++11 memory orders such as relaxed, acquire and release, Objective-C and Swift atomic versus nonatomic), mobile main-thread rules and JNI thread attachment, cancellation and shutdown idioms, and the idioms for coordinating shared state safely in that language, including thread-safe caches, singletons and bounded queues. Also covers reproducing, testing and diagnosing races and deadlocks in a specific language or app, and migrating callback, GCD or thread-pool code to structured concurrency. Covers choosing and using a language's concurrency primitives correctly. Boundary: general synchronization theory, deadlock and lock-free algorithm internals, OS scheduling, database isolation levels, and callback or event-loop architecture are covered elsewhere.

HardTechnical
21 practiced

Write a concise C++ example in which two threads using relaxed atomic stores and loads reach a state that sequential consistency forbids, as can happen on weakly ordered hardware such as ARM. Then show the minimal change that makes it correct and explain why it works.

EasyTechnical
26 practiced

Explain the meaning and use-cases of the volatile keyword in Java and compare it with the volatile qualifier in C++ prior to C++11 and with C++11 atomics. What visibility and reordering guarantees does Java volatile provide?

MediumTechnical
23 practiced

In Go, write a function that runs multiple independent checks in parallel, returns all failures in a single error value, and preserves enough context for an operator to diagnose the problem quickly. The function should respect context cancellation by stopping new work and allowing in-flight checks to exit promptly.

MediumTechnical
26 practiced

Explain the practical differences between concurrency models in Python: threading, multiprocessing, and asyncio. For each model, state when it is appropriate (network-bound, CPU-bound, I/O-bound), how the Global Interpreter Lock (GIL) affects behavior, and how you would pick one for a systems scripting task that polls thousands of sockets.

HardTechnical
34 practiced

Implement a thread-safe bounded blocking queue in Java that supports multiple producers and consumers. Explain your synchronization strategy (wait/notify vs Lock/Condition), how you avoid deadlocks and spurious wakeups, and how you'd test correctness under high concurrency. Provide code and narrate the reasoning during the implementation.

Unlock Full Question Bank

Get access to all 29 Language-Level Concurrency and Multithreading interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.