Back to problems

Ring Buffer (Producer / Consumer with Backpressure)

Object-Oriented Programming · Coinbase · Hard

Requirements Create a thread-safe ring buffer: a bounded circular queue with a capacity fixed at construction time. It must support concurrent writers and readers. Writing and reading — producers place values into the buffer, and consumers retrieve values in insertion order. Behavior at capacity — specify what a producer experiences when no slot is available. You may make the operation wait, refuse the value, or report the condition to the caller. Choose a policy and explain…

Checking your access…