DSA Studio
Search
Home
Sign in
Go Concurrency Patterns Checkpoint
Structured concurrency, cancellation, backpressure, and safe publication.
1. Structured concurrency means:
Every goroutine has a clear owner and lifetime
Always use channels instead of mutexes
Never cancel goroutines
Spawn goroutines for every task
2. Backpressure is primarily achieved by:
Unbounded queues
Bounded queues and load shedding
Ignoring slow consumers
Increasing goroutine count indefinitely
3. A safe publication pattern uses:
A channel close or mutex to establish happens-before
A shared variable with no synchronization
Busy-wait loops without atomics
Random sleeps
4. Fan-in should typically be done by:
A single aggregator goroutine
All workers writing to shared state unsafely
A busy loop with global variables
One goroutine per result with no coordination
5. When is goroutine-per-task usually a bad idea?
High-rate CPU-bound workloads
Low-rate I/O-bound workloads
Single request handling
When using contexts
6. Name one way to cancel a goroutine in Go.
Submit quiz
Auto-advance on pass