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
3
votes
1 answer

How does batch iteration work in Tensorflow?

I am trying to reuse the PTB language model on my data but lacking knowledge of Tensorflow to understand how does it handle batch iteration over the training data. Here is how I understand batch iteration during training: while epoch <= maxepoch do …
minerals
  • 6,090
  • 17
  • 62
  • 107
3
votes
1 answer

laravel queue without DB query

I want to minimize DB queries for an incoming request. It currently requires writes to 6 different tables. The processing does not need to be done before returning the response. I therefore consider laravel queues, but I wonder if I could also get…
Chris
  • 13,100
  • 23
  • 79
  • 162
3
votes
2 answers

Queue remove not working as FIFO

I am facing a problem with Queue. In my code, queue is adding items currently but have problems in removing items. I have 3 class Point and Queue, C. Point class holds the value of x, coordinate and distance. And queue Class is implemented with…
Paul
  • 35
  • 3
3
votes
3 answers

TAILQ_INSERT_TAIL macro

Can someone explain 2 last lines of TAILQ_INSERT_TAIL macro: #define TAILQ_INSERT_TAIL(head, elm, field) do { (elm)->field.tqe_next = NULL; / (elm)->field.tqe_prev = (head)->tqh_last; / *(head)->tqh_last = (elm); …
Andriy Veres
  • 81
  • 1
  • 1
  • 5
3
votes
4 answers

What is real world example for priority queue?

I'm writing a Lock-Free C library, and I'm going to implement a priority queue. However, the goal of my library is not completeness of the data structures, I just want to implement some typical ones and then write a mirco-benchmark to show that the…
3
votes
1 answer

Laravel queues - freeing up memory

Laravel 5.5 docs mention that: Daemon queue workers do not "reboot" the framework before processing each job. Therefore, you should free any heavy resources after each job completes. For example, if you are doing image manipulation with the GD…
Amade
  • 3,665
  • 2
  • 26
  • 54
3
votes
0 answers

laravel queue timing out all the time

I have successfully developed a laravel job in 5.5 locally using database queue, however moving the application to a testing server has thrown a constant issue. Every job fails immediately and is placed in the failed jobs list. The only error that…
3
votes
2 answers

Calling functions in the serial queue in Swift

I've got a function which is called by observing the NotificationCenter: NotificationCenter.default.addObserver(self, selector: #selector(observedPosition(_: ), name: "calculatePosition", object: nil) and then the function: @objc func…
mikro098
  • 2,173
  • 2
  • 32
  • 48
3
votes
6 answers

Remove the last element in a queue

I need to remove the last element of a queue. The only operations I may use are Peek() - get the first element without removing it Enqueue(element) - Insert an element to the back of the queue Dequeue() - Remove the first element IsEmpty() - true…
Bre
3
votes
2 answers

Python Queue will not release the memory after get()

I need your help about Queue memory. 1) I choose Queue as my data structure because I have one thread to feed data to the queue and another thread will take the data 2) The two threads designed to run for days 3) I don't want to limit the queue…
yuan
  • 171
  • 2
  • 7
3
votes
2 answers

Why in C# is Queue scrambling the data in its elements?

I am completely perplexed with how my Queue is function. I am attempting (and failing) to write a small multi-threaded application to collect and display data in C#. After reading through Albahari's book and using the Consumer/Producer pattern he…
Azim J
  • 8,260
  • 7
  • 38
  • 61
3
votes
3 answers

Can I reverse a queue without using stack?

I have a queue with some numbers for example 5,6,7,8 is in queue, 5 is q->front and 8 is q->rear.. Can I reverse them in queue but without using stacks?
Greedy Pointer
  • 334
  • 5
  • 12
3
votes
2 answers

Is there any advantage of doubly linked queue over singly-linked queue?

I have been asked to implement a doubly linked queue, but I know a singly-linked queue is straightforward with all of its major functions running in big-Theta 1. I am basically talking about FIFO implementation (not including special queues like…
3
votes
1 answer

Process Laravel/Redis job from multiple server

We are building a reporting app on Laravel that need to fetch users data from a third-party server that allow 1 request per seconds. We need to fetch 100K to 1000K rows based on user and we can fetch max 250 rows per request. So the restriction…
Meathanjay
  • 2,023
  • 1
  • 18
  • 24
3
votes
1 answer

How To Abort Threads that Pull Items from a Queue Using Ctrl+C In Python

I've implemented some threaded application using python. During runtime i want to catch the CTRL+C sigcall and exit the program. To do that I've registered a function called exit_gracefully which also takes care of stopping the threads in a more…
rednammoc
  • 376
  • 2
  • 11
1 2 3
99
100