Link to home
Start Free TrialLog in
Avatar of alexsheeba
alexsheeba

asked on

implement a “fair queue" class that will be used in a multi threaded environment

You are asked to show the relevant parts of the fair queue, including class headers, methods for depositing and extracting values, and other items you deem necessary. Furthermore, your implementation should maximize throughput, prevent data race conditions, and avoid starvation and deadlocks.

Avatar of ste5an
ste5an
Flag of Germany image

hmm, and what is your question?

The basic idea is that all consumers must register before an action on the queue.
Each action requires that the consumer is identified.
Each action evaluates the usage histogram and decides whether the current consumer is allowed to execute that action on the queue based on "fairness".
Hi alexsheeba

I can understand your query.
It seems that this query has been assigned to your class to complete your home work.
Can you post the code which you have tried, for us to help on the same?
or do you need us to start writing the code from
#include ....
...
return 0;
}
?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.