Questions tagged [queue]

A queue is an ordered, first-in-first-out data structure. Typical implementations of queues support pushing elements to the back and popping them off the front position.

  • A queue is not limited to a fixed capacity
    • A bounded queue is a queue limited to a fixed number of items
  • A doubly linked list is a good implementation choice

Operations

  • enqueue - pushes an element to the end of the queue
  • dequeue - pops an element from the front of the queue

See Also

Resources

Queue Wikipedia Article

11098 questions
20
votes
4 answers

How to queue background tasks in ASP.NET Web API

I have a webapi that is designed to process reports in a queue fashion. The steps the application takes are as follows: Receive content Map the content to an object and place it into the queue Poll for pending items in the queue Process items in…
appsecguy
  • 1,019
  • 3
  • 19
  • 36
20
votes
4 answers

Maximum size for multiprocessing.Queue item?

I'm working on a fairly large project in Python that requires one of the compute-intensive background tasks to be offloaded to another core, so that the main service isn't slowed down. I've come across some apparently strange behaviour when using…
Brendan Wood
  • 6,220
  • 3
  • 30
  • 28
19
votes
3 answers

C++ Create fixed size queue

In C++, how do you create a simple fixed size queue? I have done it multiple times in Java and Python but am looking for a C++ based way of doing so. I need a simple FIFO queue with only 2 elements in order to use the push and pop utilities: I am…
Employee
  • 3,109
  • 5
  • 31
  • 50
19
votes
10 answers

C# Queue or ServiceBus with no dependencies?

Is there a product (ideally open source, but not necessary), that would enable a zero dependency deployment? every service bus or queue library I've been able to find has a dependency on one of the queue apps (like msmq), or a database. I would…
Joel Martinez
  • 46,929
  • 26
  • 130
  • 185
19
votes
1 answer

Why is len() not implemented for Queues?

The built-in function len() (https://docs.python.org/3/library/functions.html#len) returns "the length (the number of items) of an object", but this is not implemented for queue.Queue (https://docs.python.org/3/library/queue.html). Instead,…
cdjc
  • 1,039
  • 12
  • 24
19
votes
4 answers

Serialization of 'Closure' is not allowed in Laravel 5.3 Email Queue

I am willing to send email to list of email address using queue. Without using queue my code is working fine but with queue it's showing following error: Exception in Queue.php line 86: Serialization of 'Closure' is not allowed in…
hizbul25
  • 3,829
  • 4
  • 26
  • 39
19
votes
1 answer

Implementation of multiprocessing.Queue and queue.Queue

I am looking for more insights on the Queues implementations in Python than I can find in the documentation. From what I understood, and excuse my ignorance if I am wrong on this: queue.Queue(): is implemented through basic arrays in-memory and so…
Fabien
  • 4,862
  • 2
  • 19
  • 33
19
votes
3 answers

Explain Michael & Scott lock-free queue alorigthm

I am studying Michael & Scott's lock-free queue algorithm and trying to implemented it in C++. But I produced a race in my code and think there may be a race in the algorithm. I read the paper here: Simple, Fast, and Practical Non-Blocking and…
Eddie Deng
  • 1,399
  • 1
  • 18
  • 30
19
votes
2 answers

How to send JSON payload to RabbitMQ using the web plugin?

I have a RabbitMQ 3.4.2 instance with a web management plugin installed. When I push to the message {'operationId': 194} to the queue using Python's kombu queue package, the message is read on the other end as a dictionary. However, when I send the…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
19
votes
2 answers

What is the difference between 'thread' and 'queue' in iOS development?

I am new to iOS development. Now I am quite confused about the two concepts: "thread" and "queue". All I know is that they both are about multithread programming. Can anyone interpret those two concepts and the difference between them for me?…
Jay
  • 998
  • 2
  • 15
  • 24
19
votes
2 answers

RabbitMQ non-blocking consumer

I'm using RabbitMQ in Python to manage several queues between a producer and multiple consumers. In the example in RabbitMQ website (routing model), the consumers are blocked. It means that they stop on start_consuming() and execute the callback…
Hugo Sousa
  • 906
  • 2
  • 9
  • 27
19
votes
3 answers

How to delete a queue in rabbit mq

I am using rabbitmctl using pika library. I use the following code to create a Producer #!/usr/bin/env python import pika import time import json import datetime connection = pika.BlockingConnection(pika.ConnectionParameters( …
Shweta B. Patil
  • 1,131
  • 2
  • 11
  • 19
19
votes
4 answers

dumping queue into list/array in python

I am running a number of threads and collecting there result on a queue. I would like to dump it into array or list so that I can do indexing and retrieve those results. Each of the elements in the queue is a array of dimension n. I would like to…
thetna
  • 6,903
  • 26
  • 79
  • 113
19
votes
2 answers

FIFO Map with limited elements

I need a HashMap or simpy a Map with a fixed number of elements (n) working like a FIFO queue. So until the element number is <= n new elements are simply put in the map. For element number > n the first inserted element is removed and the newest is…
davioooh
  • 23,742
  • 39
  • 159
  • 250
19
votes
1 answer

Check if element is already in a Queue

I am using the Queue library in python and I want to keep queue entries unique. As such I want to check 'something' isn't already in the queue before adding to it, essentially a function like this which works on the Queue library: queue =…
Riley Kidd
  • 195
  • 1
  • 1
  • 4