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.

MediumTechnical
25 practiced

In Go, implement a fan-out/fan-in pipeline that sends the same request to multiple backends, returns the first successful response, and cancels the remaining work immediately. The solution must not leak goroutines, must collect all errors if every backend fails, and must respect a parent context.

EasyTechnical
32 practiced

Implement a concurrent counter in Go with Inc() and Value() operations that does not use sync.Mutex. Give a short code sketch and explain the trade-offs against a mutex-based version in a production server.

MediumTechnical
23 practiced

A Go service leaks goroutines: some are blocked on network reads and never exit when the service shuts down. How would you make shutdown deterministic, and how would you confirm in production that no goroutines are leaking?

MediumTechnical
34 practiced

Implement a graceful shutdown pattern for an asyncio-based HTTP server in Python: stop accepting new connections, allow in-flight requests to complete with a configurable timeout, cancel long-running background tasks, flush metrics, and then exit. Provide function outlines for signal handling and describe race conditions to watch for.

MediumTechnical
21 practiced

Explain the C++11 memory model: sequential consistency and the semantics of memory_order_relaxed, acquire, release and acq_rel. Give a practical example, such as a service metrics counter, where relaxed atomics are safe and a case where they would be wrong.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.