Embedded Developer

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.

50 min

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

This lesson is part of the Pro plan. Upgrade to unlock the full lesson, the labs and the exam.

Upgrade Now

This lesson is part of a paid plan

Upgrade to Pro to unlock this course, its labs and its exam.

View Pricing Plans