ArticleslgStudy

computer science

Deficit round robin

Deficit round robin is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Deficit round robin rather than just read about it. In short: Deficit round robin (DRR), also deficit-weighted round robin (DWRR), is a scheduling algorithm for the network scheduler. DRR is, similar to weighted fair queueing (WFQ), a packet-based implementation of the ideal generalized processor sharing (GPS) policy.

Key takeaways

  • Deficit round robin belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Deficit round robin to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Deficit round robin from memory before moving on to harder problems.

Reference excerpt

Deficit round robin (DRR), also deficit-weighted round robin (DWRR), is a scheduling algorithm for the network scheduler. DRR is, similar to weighted fair queueing (WFQ), a packet-based implementation of the ideal generalized processor sharing (GPS) policy. It was proposed by M. Shreedhar and G. Varghese in 1995 as an efficient (with O(1) complexity) and fair algorithm.

Details In DRR, a scheduler handling N flows is configured with one quantum Qi for each flow. This global idea is that, at each round, the flow i can send at most Qi bytes, and the remaining, if any, is reported to the next round. In this way, the minimum rate that flow i will achieve over the long term is Qi(Q1+Q2+...+QN)R; where R is the link rate.

Algorithm The DRR scans all non-empty queues in sequence. When a non-empty queue i is selected, its deficit counter is incremented by its quantum value. Then, the value of the deficit counter is a maximal number of bytes that can be sent at this turn: if the deficit counter is greater than the packet's size at the head of the queue (HoQ), this packet can be sent, and the value of the counter is decremented by the packet size. Then, the size of the next packet is compared to the counter value, etc. Once the queue is empty or the value of the counter is insufficient, the scheduler will skip to the next queue. If the queue is empty, the value of the deficit counter is reset to 0.

Variables and Constants const integer N // Nb of queues const integer Q[1..N] // Per queue quantum integer DC[1..N] // Per queue deficit counter queue queue[1..N] // The queues

Scheduling Loop while true do for i in 1..N do if not queue[i].empty() then DC[i]:= DC[i] + Q[i] while( not queue[i].empty() and DC[i] ≥ queue[i].head().size() ) do DC[i] := DC[i] − queue[i].head().size() send( queue[i].head() ) queue[i].dequeue() end while if queue[i].empty() then DC[i] := 0 end if end if end for end while

Performances: fairness, complexity, and latency Like other GPS-like scheduling algorithms, the choice of the weights is left to the network administrator. Like WFQ, DRR offers a minimal rate to each flow, regardless of the size of the packets. In weighted round robin scheduling, the fraction of bandwidth used depends on packet sizes. Compared with WFQ scheduler that has complexity of O(log(n)) (n is the number of active flows/queues), the complexity of DRR is O(1), if the quantum Qi is larger than the maximum packet size of this flow. Nevertheless, this efficiency has a cost: the latency, i.e., the distance to the ideal GPS, is larger in DRR than in WFQ. More on the worst-case latencies can be found here.

Implementations An implementation of the deficit round-robin algorithm was written by Patrick McHardy for the Linux kernel and published under the GNU General Public License. In Cisco and Juniper routers, modified versions of DRR are implemented: since the latency of DRR can be larger for some class of traffic, these modified versions give higher priority to some queues, whereas the others are served with the standard DRR algorithm.

See also Weighted round robin Fairness measure

Notes

References

External links UC Berkeley EE122 lecture: Efficient fair queueing using deficit round robin

Worked examples

Example 1 — a first encounter with Deficit round robin

Start with the simplest possible case. Write down what Deficit round robin claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Deficit round robin before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Deficit round robin ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Deficit round robin

In research
Deficit round robin appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Deficit round robin in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Deficit round robin is common in secondary-school and first-year university syllabi. It links to neighbouring topics Network scheduling algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Deficit round robin outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Deficit round robin” →

How to study Deficit round robin in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Deficit round robin means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Deficit round robin out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Deficit round robin in simple terms?

Deficit round robin (DRR), also deficit-weighted round robin (DWRR), is a scheduling algorithm for the network scheduler. DRR is, similar to weighted fair queueing (WFQ), a packet-based implementation of the ideal generalized processor sharing (GPS) policy.

Why does Deficit round robin matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Deficit round robin?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Deficit round robin.

Tags

  • Network scheduling algorithms

Keep exploring