2dbi
Home/Databricks/Implement a Thread-Safe Blocking Queue
DDatabricks·DSASDE-2Onsite – Concurrency / Multithreading

Implement a Thread-Safe Blocking Queue

Problem

Implement a bounded blocking queue for multiple producers/consumers (Databricks has a dedicated concurrency round).

Example

put() blocks when full; take() blocks when empty; no busy-wait

Constraints

  • Correct under high concurrency

What Databricks looks for

Correctness over cleverness — a simple, reasoned synchronized solution beats a fragile lock-free one. Discuss condition variables and spurious wakeups.

added 6 days ago
LeadersAccount