EmbeddedRelated.com
Scorchers, Part 3: Bare-Metal Concurrency With Double-Buffering and the Revolving Fireplace

Scorchers, Part 3: Bare-Metal Concurrency With Double-Buffering and the Revolving Fireplace

Jason Sachs
TimelessIntermediate

This is a short article about one technique for communicating between asynchronous processes on bare-metal embedded systems. Q: Why did the multithreaded chicken cross the road? A: to To other side. get the — Jason Whittington There...


Summary

This short blog explains a practical double-buffering technique for communicating between asynchronous processes on bare-metal embedded systems. Jason Sachs walks through how the "revolving fireplace" pattern swaps buffers safely without locks, and when to choose this approach over RTOS-based synchronization.

Key Takeaways

  • Implement a double-buffering (revolving fireplace) pattern to safely exchange data between producers and consumers on bare-metal systems.
  • Avoid locks by using single-writer/single-reader buffer semantics and a simple buffer-index swap protocol.
  • Apply memory ordering techniques (volatiles, barriers, or atomics) appropriate to the target CPU to ensure data coherency.
  • Design and test edge cases: buffer overrun, late readers, and interrupt-driven producers to guarantee deterministic behavior.

Who Should Read This

Embedded firmware engineers and developers with some bare-metal experience who need lightweight, deterministic concurrency solutions without an RTOS.

TimelessIntermediate

Topics

Bare-Metal ProgrammingFirmware DesignRTOSARM Cortex-M

Related Documents