Case File: The Buffer That Lost the Newest Reading
A ring buffer is a fixed-size queue between an interrupt that receives data and the main loop that processes it. It never grows, so a full one forces a choice: throw away the new value, or throw away the oldest one. Simulate pushes and pops in order, with both policies, collect the values popped and dropped, count the pops on an empty buffer, report what is left and the high water mark, and the share of values lost. Run it on buffers that you cannot see, including a buffer of capacity 1. The operations are generated for you alone.
Case File: The Buffer That Lost the Newest Reading
A ring buffer is a fixed-size queue between an interrupt that receives data and the main loop that processes it. It never grows, so a full one forces a choice: throw away the new value, or throw away the oldest one. Simulate pushes and pops in order, with both policies, collect the values popped and dropped, count the pops on an empty buffer, report what is left and the high water mark, and the share of values lost. Run it on buffers that you cannot see, including a buffer of capacity 1. The operations are generated for you alone.
In this lesson:
- ring buffer
- queue
- interrupts
- overflow
- python
- case-file
This lesson is part of a paid plan
Upgrade to Pro to unlock this course, its labs and its exam.
View Pricing Plans