1

There is a multi-threaded environment and multiple threads enqueue and dequeue a priority queue. In case when one or more of the threads add only high priority queue items, there is a possibility that, items with lower priority will never exit the queue. I was wondering if there is any technique to avoid this.

I would appreciate any help. Thanks in advance.

John
  • 15
  • 2
  • You are talking about [starvation](https://en.wikipedia.org/wiki/Starvation_(computer_science)) – Idos Mar 19 '16 at 19:33

1 Answers1

0

As I stated in the comment, you are referring to starvation:

Starvation is a problem encountered in concurrent computing where a process is perpetually denied necessary resources to process its work.

There are multiple ways to handle this, namely scheduling algorithms such as Round-Robin, Fair queuing, Proportionally fair and Maximum throughput scheduling.

Read further in this question - What is starvation?

Community
  • 1
  • 1
Idos
  • 15,053
  • 14
  • 60
  • 75