circular-buffer Questions

5

Solved

I am thinking about implementing a lock free circular array. One problem is maintaining the head and tail pointers in a lock free manner. The code I have in mind is: int circularIncrementAndGet(At...
Lusty asked 2/1, 2014 at 19:42

22

Solved

Has anyone already implemented a circular buffer in JavaScript? How would you do that without having pointers?
Glaydsglaze asked 17/10, 2009 at 20:29

0

I want to know the history of the standardization of the circular buffer(circular queue or deque). AFAIK, the current C++ standard(C++ 2023) doesn't provide a circular buffer in the STL. I googled ...
Overrun asked 8/8, 2023 at 2:39

15

Solved

I want to create an efficient circular buffer in python (with the goal of taking averages of the integer values in the buffer). Is this an efficient way to use a list to collect values? def add_t...
Greysun asked 11/11, 2010 at 4:17

7

Solved

What are some of the uses of circular buffer? What are the benefits of using a circular buffer? is it an alternative to double linked list?
Hexapod asked 31/3, 2010 at 14:13

2

I need to cache the least recent result (say 10,000) of a concurrent system, and random access them. Since most of concurrent cache are based on linked list, I'm wondering if there is a thread safe...
Hispidulous asked 8/3, 2020 at 16:56

9

Solved

I have an array like [A,B,C,D]. I want to access that array within a for loop like as var arr = [A,B,C,D]; var len = arr.length; for(var i = 0; i<len; i++){ 0 - A,B,C 1 - B,C,D 2 - C,D,A 3 ...
Detrude asked 5/7, 2013 at 7:15

3

Solved

On Ring Buffer's Wikipedia entry, there's example code showing a hack for UNIX systems whereby the adjacent virtual memory to a piece of memory is mapped to the same phbysical memory, thus implemen...
Promontory asked 19/6, 2009 at 8:21

8

Solved

I want to do some performance measuring of a particular method, but I'd like to average the time it takes to complete. (This is a C# Winforms application, but this question could well apply to othe...
Dinothere asked 17/6, 2011 at 22:37

9

Solved

I have a need for a fixed-size (selectable at run-time when creating it, not compile-time) circular buffer which can hold objects of any type and it needs to be very high performance. I don't think...
Minium asked 6/5, 2009 at 1:52

8

Solved

Consider a few web server instances running in parallel. Each server holds a reference to a single shared "Status keeper", whose role is keeping the last N requests from all servers. For example (...
Hen asked 18/6, 2012 at 8:24

1

I use an anonymous mmap to allocate a giant chunk of memory. There are several contiguous pages in this that I'd like to turn into a ring buffer, using virtual memory mirroring. This example on Wi...
Rupp asked 14/1, 2014 at 11:41

1

I did some search on the implementation of deque. According to this post, deque uses vector of vectors. I know pushing at the begin and end should be both in constant time, and also random access i...
Pacesetter asked 27/10, 2016 at 2:23

5

Solved

I'm using a circular buffer to push data onto either end of a list. After I'm done I want to align the buffer so the first element in the list is at position zero and can be used like a regular arr...
Abradant asked 31/1, 2014 at 12:9

5

Solved

I'd like some help improving the efficiency of my circular buffer code. I had a look around stackoverflow and found that (nearly) all of the topics on circular buffers are about the uses of such a...
Yellowthroat asked 15/3, 2012 at 10:44

1

Solved

I have been working on data logger for an embedded device. The goal is to store values of a set of variables in periodic manner into the external flash memory. My idea is to create a buffer in RAM....
Masonite asked 2/1, 2019 at 9:34

5

Solved

I want a simple yet efficient circular buffer/queue. If I use std::vector, I have to do this: if ( v.size() >= limit ) { std::vector<int> it = v.begin(); v.insert( it, data ); v.erase(...
Tardif asked 1/3, 2012 at 13:3

3

Solved

This is my implementation of a circular array so far. It is supposed to store the last 5 commands entered, by entering the 6th command in the place of the 5th and discarding the 1st. What I have ma...
Indigenous asked 25/2, 2013 at 20:27

1

Is it possible to use boost::circular_buffer with boost::asio? Specifically I want to read a fixed number of bytes with boost::asio::async_write and store them directly in the circular buffer with...
Vassaux asked 8/11, 2013 at 13:6

3

Recently, in an interview I was asked the disadvantage of using circular queue. I couldn't think of any. Searching the internet the only answer I found is that it's difficult to implement than line...
Benedetto asked 16/2, 2013 at 6:10

6

Solved

I was wonder if there is a simpler (single) way to calculate the remaining space in a circular buffer than this? int remaining = (end > start) ? end-start : bufferSize - start + end;
Sorce asked 16/1, 2009 at 14:33

1

Solved

I am using PortAudio to implement a real-time audio processing. My primary task is to acquire data from mic continuously and provide 100 samples for processing (each FRAME = 100 samples at a time...
Buckeen asked 20/6, 2017 at 6:32

1

Solved

I’m writing a traffic generator in C using the PACKET_MMAP socket option to create a ring buffer to send data over a raw socket. The ring buffer is filled with Ethernet frames to send and sendto is...
Chloride asked 3/4, 2017 at 20:42

2

Solved

Here is a class that contains a boost::circular_buffer of some struct. I make a typedef for iterators into the contained circular_buffer. My problem is this: when the doWork function is marked co...
Failure asked 30/8, 2016 at 22:50

3

Solved

I'm trying to find a way to make a Lock Free OR Non-blocking way to make a Ring Buffer for single consumer / single consumer that will over-write the oldest data int the buffer. I've read a lot of ...
Reify asked 10/12, 2010 at 4:42

© 2022 - 2024 — McMap. All rights reserved.