Questions tagged [queue]
A queue is an ordered, first-in-first-out (FIFO) data structure. Typical implementations of queues support pushing elements to the back and popping them off the front position.
399 questions
8
votes
1
answer
594
views
Shared-Memory Queue Implementation in C
Recently I am working on implementing a shared-memory based IPC message queue in C programming language on Linux system. A few design choices I've made include
The queue will have only 1 producer, ...
1
vote
2
answers
155
views
ProducerConsumerSimulation.java: practicing concurrent programming in Java
Intro
This time, I was in the mood for concurrent programing (ProducerConsumerSimulation.java). To this end, I have ended up with the code below. My primary concerns are:
Class design is trash,
The ...
4
votes
1
answer
315
views
8
votes
2
answers
318
views
Multi-producer, multi-consumer blocking queue
Introduction
This is a queue that allows many producers to simultaneously write their items and many consumers to simultaneously read theirs. It's useful when construction and/or consumption could be ...
5
votes
3
answers
624
views
C++ std::function-like queue
I aim to create a call queue to schedule work for another thread.
I'm using a virtual base class for type erasure and placement new for reducing the number of allocations, but, as far as I know, ...
6
votes
3
answers
709
views
Ring Buffer Implementation in C++
The following code is designed for handling real-time messages. It assumes there will be only two threads using the RingBuffer object:
A provider thread calls the <...
3
votes
1
answer
83
views
A Simple BlockingQueue implementation in C++
I'm just dusting off my C++ knowledge in area of multithreading.
I started with implementing a producer-consumer pattern inspired by https://jenkov.com/tutorials/java-util-concurrent/blockingqueue....
3
votes
1
answer
69
views
A generic queue that transfers data from interrupt to main program
This code aims to implement a queue, which transfers data from interrupt to main program in a bare metal embedded system. There are two execution points, the main program and the irq handler. Both ...
9
votes
2
answers
641
views
Advent of code 2023 day 5 in Java: mapping integer ranges to new integer ranges
Context
I'll be passing an interview coding test in java soon. I am experienced with other programming languages but am very unfamiliar with Java. I am looking for critiques of the coding style much ...
-1
votes
1
answer
85
views
Queue implementation in C# [closed]
I have tried to implement a queue from scratch, and it doesn't really seem to match what i found on internet, and I am wondering if this is a correct implementation, and what makes using Stack ...
6
votes
3
answers
655
views
3
votes
2
answers
91
views
Enhancing a non-multithreaded Circular buffer
Looking to get some feedback on a simple non-multithreaded circular buffer.
Ideally, I'd want to have a logic to prevent the data from getting overwritten but couldn't find a reasonable way.
For ...
6
votes
1
answer
514
views
Synchonizing queue with mutex
I am trying to syncronize the queue between threads using mutex. I have 2 mil random integers in input.txt file. Main thread reads integers then puts them in queue. Other threads are simultaneously ...
1
vote
1
answer
125
views
Queue-mergesort: a mergesort that does optimal number of comparisons in the worst case in Java
Here is the code for queue-mergesort by Mordecai J. Golin and Robert Sedgewick:
com.github.coderodde.util.QueueMergesort.java:
...
4
votes
1
answer
307
views
Blocking Queue Class Unit Test
I would like any feedback on making the unit test for a BlockingQueue class more robust or better? improvements to the coding style, use of the ...