Building a lock free continuous ring buffer in Rust

Building a lock free continuous ring buffer in Rust

In order to minimize the amount of time necessary for the CPU to manually copy data from one place to another, these Peripherals can be configured to perform an action completely autonomously, streaming data to or from a section of memory on the CPU. At 115,200 bits on the wire per second, this means it will take 347,220 nanoseconds to receive the same four bytes, taking 22,222 times as long as it takes our CPU to copy the same amount of data! Here’s where the original BipBuffer design decides to maintain two “regions” of valid data, one at the start and one at the end of the buffer: this way it can keep track of which sections of the buffers contain valid data.

Source: ferrous-systems.com