Ring Buffer

noun

say it: “RING BUF-er” /rɪŋ ˈbʌfər/

A queue kept in a fixed-size array whose front and back wrap around, so freed slots are reused.

What is a ring buffer?

A ring buffer (or circular buffer) keeps a queue in a fixed number of slots arranged like seats around a round table. The back is (front + count) modulo the capacity, so after the last slot comes slot 0 again. Nothing ever moves and nothing grows, which suits keyboards, audio and "the last 100 log lines".

In a sentence

  • “The keyboard keeps the keys you've typed in a ring buffer until the program reads them.”

Level: Journeyman · More Data Structures terms at this level

Updated