Skip to content

Use case clarification #121

Answered by jdonszelmann
andrewbaxter asked this question in Q&A
Discussion options

You must be logged in to vote

You are right that reading and writing from two places in the program requires some kind of synchronization primitive. Indeed, ringbuffer does not aim to be inherently thread-safe, like some other ringbuffers might be. Often such implementations use atomics, and this is something we do not do and decided we will never do. It turns out that that's essentially a completely different data structure.

So what can ringbuffer be used for? We've seen it be used in a wide range of situations. One example I've seen many times is if there's some stream of data coming in, and you care only about storing the last n bytes. We've seen people use it as part of decompression algorithms, where the compress…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@andrewbaxter
Comment options

@andrewbaxter
Comment options

@jdonszelmann
Comment options

@andrewbaxter
Comment options

@jdonszelmann
Comment options

Answer selected by andrewbaxter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants