2dbi
Home/Nvidia/Producer-Consumer With a Bounded Buffer
NNvidia·DSASDE-2Onsite – Coding 1

Producer-Consumer With a Bounded Buffer

Problem

Implement a thread-safe bounded queue with blocking put/take for multiple producers and consumers.

Example

Buffer size 1; producer and consumer alternate without busy-waiting

Constraints

  • No data races, no deadlock

Approach

Mutex + two condition variables (not-full / not-empty). Explain why a single condvar is insufficient.

added 6 days ago
LeadersAccount