Back to problems

Single-Producer Multi-Consumer Ring Buffer

Object-Oriented Programming · Citadel · Medium

Requirements Design a ring buffer backed by a fixed-size circular array. It must satisfy these semantics: There is exactly one producer thread, which inserts values through push(item). When the buffer is full, the candidate must choose and document the policy: discard the oldest value, discard the incoming value, block the producer, or report the condition. Several consumer threads may independently invoke pop() -> item. Each consumer has a logical read position, and a value…

Checking your access…