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.

EasyTechnical
20 practiced

In Swift, show how to use OperationQueue to execute background operations while limiting concurrency to a maximum of 3 concurrent operations, and how to set dependencies between operations so a final UI update only runs after others complete.

HardTechnical
18 practiced

A complex intermittent deadlock involves a background sync thread pool, a SQLite wrapper using a single connection, and UI code that sometimes performs synchronous DB reads on the main thread. Propose a root-cause analysis plan listing which thread dumps and lock-orderings to inspect, and recommend architectural and code changes to eliminate deadlock while preserving responsiveness. Provide an example of safe DB access code that avoids blocking the main thread.

MediumTechnical
22 practiced

Compare the trade-offs of using a serial DispatchQueue, NSLock, and the Swift actor model to protect shared mutable state. For each approach describe performance characteristics, fairness, deadlock risk, composability, and Objective-C interoperability considerations and give an example scenario where it would be the preferred solution.

HardTechnical
25 practiced

Your team owns a large iOS and Android app built on callbacks, GCD and thread pools. How would you migrate it incrementally to structured concurrency (Swift async/await, Kotlin coroutines) without regressions?

MediumBehavioral
21 practiced

Describe a situation where you found a subtle race condition or concurrency bug in a multi-threaded or async project. Explain how you reproduced the issue, debugging tools or logging you used, the root cause (ordering, shared state), and the fix you implemented. How did you ensure the fix covered all relevant code paths?

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.