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
19 practiced

Describe Kotlin coroutines' Dispatchers.IO, Dispatchers.Main, and Dispatchers.Default. For an app that downloads images and decodes them, specify which dispatcher you would use for network download, for image decoding, and for updating the UI, and justify each choice based on blocking vs CPU-bound characteristics.

MediumTechnical
22 practiced

Compare Kotlin's synchronized, volatile, AtomicInteger/AtomicReference with coroutine patterns for sharing mutable state. For an Android app, when would each mechanism be appropriate? Discuss visibility and atomicity guarantees under the JVM memory model and expected performance characteristics.

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

Design a thread-safe caching layer on Android using Kotlin coroutines and Flow that exposes a Flow of cached values, supports refresh on demand, avoids blocking the main thread, and safely invalidates stale entries. Describe APIs, coroutine scopes, dispatcher choices, and how you handle concurrent refreshes for the same key.

MediumTechnical
18 practiced

Implement a thread-safe lazily initialized singleton in both Kotlin and Swift. Explain the memory visibility and double-initialization problems each platform's mechanism solves, and why the pattern you chose is safe on that platform.

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.