Skip to content
tezvyn:

Concurrency

183 bites tagged Concurrency — interview questions with model answers, and 60-second explainers.

Growth & Experimentation2 min read

How would you enforce a 3-project freemium limit and handle upgrades?

Tests entitlement and growth tradeoffs. Strong answers use API-level enforcement, atomic checks to prevent concurrent overages, soft upsell prompts preserving context, and async billing webhooks. Red flag: UI checks or limits in the projects table.

Go & Rust2 min read

How do you use ResetTimer, StopTimer, and RunParallel in Go benchmarks?

Tests Go benchmark timer hygiene and parallel execution. A strong answer covers b.StopTimer before setup, b.ResetTimer before the loop, and b.RunParallel for CPU-bound scaling. A red flag is resetting without stopping or using parallel benchmarks for I/O.

Go & Rust2 min read

What is go test -race and when is it crucial?

This tests knowledge of Go's race detector. A strong answer says -race instruments code to detect racy reads/writes, finds data races not deadlocks, and is crucial for concurrent apps under load.

Go & Rust2 min read

What Go tool detects data races and how do you invoke it?

This tests Go's built-in race detector. A strong answer names the -race flag, notes it instruments memory accesses to catch concurrent unsynchronized reads/writes, and shows go test -race. A red flag is confusing it with static analysis or external tools.

Go & Rust2 min read

When should Rust atomics replace a Mutex, and how do orderings work?

Atomics replace mutexes for counters; Relaxed is atomicity only, SeqCst adds global order, weaker ones skip fences on ARM. Lock-free costs and hardware reordering. Atomics as a blind faster Mutex.

Go & Rust2 min read

Go select vs Rust select! fairness and determinism

This tests runtime fairness in concurrent primitives. Contrast Go's pseudo-random case selection with Tokio's randomized default and its opt-in biased; top-down mode. Red flag: claiming Go uses source order or that Rust randomization is unavoidable.

Go & Rust2 min read

What is Go's context package and how do you use WithCancel?

This tests cancellation propagation. A good answer says Context carries deadlines, signals; derive a child with WithCancel, pass it to worker, then call cancel to unblock ctx.Done. Bad: storing context in structs, leaking cancel functions, or ignoring Done.

Go & Rust2 min read

Buffered vs unbuffered Go channels and deadlock scenario

Tests channel synchronization semantics. Unbuffered channels block until sender and receiver rendezvous; buffered channels block only when full or empty. Deadlock: goroutine sends on unbuffered channel with no receiver.

Go & Rust2 min read

How do Send and Sync prevent data races? Give a Send-but-not-Sync example.

Explain Send moves values and Sync allows shared references across threads; give Cell as Send but not Sync because it has interior mutability. Rust's thread-safety model. conflating them or naming Rc, which lacks both.

Go & Rust2 min read

What is the fundamental difference between a goroutine and an OS thread?

This tests your grasp of Go's M:N scheduler. A strong answer notes that goroutines are runtime-managed, multiplexed onto OS threads, and use far less memory per unit, enabling thousands of concurrent tasks.

Go & Rust1 min read

How do you safely share a Go map across goroutines?

Tests Go memory model. Answer: maps are not concurrency-safe and risk panic or corruption; use sync.RWMutex with map for read-heavy cases or sync.Map for cache-like patterns. Red flag: suggesting runtime.GOMAXPROCS or channel-only access without justification.

Go & Rust2 min read

Compare Go's GC and Rust's ownership across performance, productivity, and safety

This tests memory-model trade-offs. Contrast Rust's compile-time ownership for deterministic, zero-cost safety against Go's GC, which optimizes simplicity and onboarding but adds runtime overhead. Red flag: calling one strictly superior.

Go & Rust2 min read

TCP Listeners: Go vs Rust

Go spins up TCP listeners and handles connections with lightweight goroutines—1 million costs ~500MB—but GC pauses introduce 2-5ms latency. Rust trades boilerplate for zero-cost safety and consistent sub-100µs response times without garbage collection.

Go & Rust2 min read

CSP: Model Concurrency with Message Passing

CSP treats concurrency as isolated processes talking through channels, not threads fighting over shared memory. It shaped Go, Erlang, and occam. Engineers often retrofit shared-state patterns into channel-based code and reintroduce race conditions.

Flutter & Dart2 min read

How do you handle CPU-bound tasks without freezing the Flutter UI?

Tests whether you know async/await yields for I/O but cannot parallelize CPU work. A strong answer defines Isolates as isolated heaps with message-passing, contrasts them with threads, and shows how compute() wraps Isolate.spawn.

Flutter & Dart2 min read

Fix UI jank from file reads and SQLite inserts using Isolates

This tests whether you know heavy synchronous work blocks Dart's UI event loop past the 16ms frame budget. A strong answer offloads parsing and SQLite inserts to a worker isolate via compute, returning results.

Flutter & Dart2 min read

What is a Dart Isolate and how does it differ from threads?

Tests Dart's shared-nothing concurrency model. Define an isolate as an independent heap plus event loop, contrast it with shared-memory threads, and explain UI isolate communication via async message ports.

Flutter & Dart2 min read

Fetch user profiles concurrently and handle individual failures

Tests Future.wait concurrency and per-future error isolation. Answer: map IDs to fetchProfile, pass to Future.wait. For partial failures, attach catchError per future to return null, then filter. Red flag: try-catch around Future.wait or sequential awaits.

Flutter & Dart2 min read

Describe the Dart event loop and queue execution order

Tests your grasp of Dart's single-threaded event loop priority. Great answers state: microtasks drain fully before the next event processes, cycling forever. Red flag: saying Future and scheduleMicrotask interleave in call order.

Content & Copywriting2 min read

Explain concurrency vs parallelism: junior paragraph, UI tooltip, justify

This tests audience-adaptive technical writing and conceptual precision. A strong answer gives the junior a structural analogy, the UI a one-sentence action metric, and justifies why detail and brevity swap by context.

Content & Copywriting2 min read

How would you script a concurrency analogy for junior developers?

This tests scaffolding hard ideas via ADEPT. A strong answer sequences analogy, diagram, example, plain-English reasoning, and technical notation while flagging where metaphor breaks. A red flag is treating the analogy as proof or ignoring its failure modes.

Android & Kotlin2 min read

What is the role of TestDispatcher and runTest in coroutine testing?

This tests coroutine test infrastructure and virtual time control. A great answer says runTest installs a TestDispatcher and TestScope, skips delays automatically, and exposes advanceTimeBy to test timeouts instantly.

Android & Kotlin2 min read

Explain Structured Concurrency in Kotlin Coroutines

Structured concurrency binds coroutines to a scope; parent cancellation propagates to all children, preventing leaks. your grasp of Kotlin coroutine parent-child scope hierarchies. calling them unmanaged threads.

Android & Kotlin2 min read

What is a CoroutineDispatcher and when to use Default versus IO?

This tests thread pool selection and the CPU versus IO distinction. A strong answer maps CoroutineDispatcher to the thread pool, Default to CPU work, IO to blocking IO, and Main to the UI thread.

Get Concurrency bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.