ALERT

[LAST CHANCE] Data Layer: Modern Business, Defined

Ring Buffer

Definition - What does Ring Buffer mean?

A ring buffer is a data structure that is treated as circular although it its implementation is linear. A circular buffer is typically used as a data queue. A circular buffer is a popular way to implement a data stream because the code can be compact.

A ring buffer is also known as a circular buffer, circular queue or cyclic buffer.

Techopedia explains Ring Buffer

A ring buffer is a common implementation of a queue. It is popular because circular queues are easy to implement. While a ring buffer is represented as a circle, in the underlying code, a ring buffer is linear. A ring buffer exists as a fixed-length array with two pointers: one that represents the head of a queue, and another that represents the tail. In a queue, elements are added to the tail of the queue in a “FIFO” (first in-first out) fashion. The first elements of the queue are removed from the head in the order they were added. When the head pointer gets to the end of the array, it wraps around to the first element in the array. Any data in the buffer is overwritten. The head of the queue is different from the first element in the actual array and both pointers move as elements are added and removed.

One disadvantage of a ring buffer is its fixed size. For queues where elements need to be added and removed in the middle, not just at the start and end of a buffer, an implementation as a linked list is the preferred approach.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources
The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.