Ring buffers, queues and stacks in C
Study fixed-capacity FIFO storage, wraparound and the assumptions behind single-producer/single-consumer designs.
View lesson accessAll lessonsWhat the lesson covers
The course lesson is called The UART that drops bytes. A UART interrupt delivers bytes in bursts of four. The main loop reads one at a time, and a single shared variable loses most of every burst.
- queue
- ring buffer
- ISR-safe SPSC
- stack
- monotonic stack
Before you start
Question to think about: How will the design distinguish an empty queue from a full queue?
Preparation exercise: Define capacity and overflow behavior before testing sequential operations; state separately what concurrency assumptions are required.
This is an original public study prompt, not the paid lesson or its solution. The interactive course contains the walkthroughs, labs, exercises and recaps.
Related free reading
Test your understanding
Practice free firmware interview questions and mock interviews · Assess your readiness