ArticleslgStudy

computer science

Weighted fair queueing

Weighted fair queueing 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 Weighted fair queueing rather than just read about it. In short: Weighted fair queueing (WFQ) is a network scheduling algorithm. WFQ is both a packet-based implementation of the generalized processor sharing (GPS) policy, and a natural extension of fair queuing (FQ).

Key takeaways

  • Weighted fair queueing 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 Weighted fair queueing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Weighted fair queueing from memory before moving on to harder problems.

Reference excerpt

Weighted fair queueing (WFQ) is a network scheduling algorithm. WFQ is both a packet-based implementation of the generalized processor sharing (GPS) policy, and a natural extension of fair queuing (FQ). Whereas FQ shares the link's capacity in equal subparts, WFQ allows schedulers to specify, for each flow, which fraction of the capacity will be given. Weighted fair queuing is also known as packet-by-packet GPS (PGPS or P-GPS) since it approximates generalized processor sharing "to within one packet transmission time, regardless of the arrival patterns."

Parametrization and fairness Like other GPS-like scheduling algorithms, the choice of the weights is left to the network administrator. There is no unique definition of what is "fair" (see Fair queuing § Fairness for further discussion). By regulating the WFQ weights dynamically, WFQ can be utilized for controlling the quality of service, for example, to achieve guaranteed data rate. Proportionally fair behavior can be achieved by setting the weights to w i = 1 / c i {\displaystyle w_{i}=1/c_{i}} , where c i {\displaystyle c_{i}} is the cost per data bit of data flow i {\displaystyle i} . For example, in CDMA spread spectrum cellular networks, the cost may be the required energy (the interference level), and in dynamic channel allocation systems, the cost may be the number of nearby base station sites that can not use the same frequency channel, in view to avoid co-channel interference.

Algorithm In WFQ, a scheduler handling N flows is configured with one weight w i {\displaystyle w_{i}} for each flow. Then, the flow of number i {\displaystyle i} will achieve an average data rate of w i ( w 1 + w 2 + . . . + w N ) R {\displaystyle {\frac {w_{i}}{(w_{1}+w_{2}+...+w_{N})}}R} , where R {\displaystyle R} is the link rate. A WFQ scheduler where all weights are equal is a FQ scheduler. Like all fair-queuing schedulers, each flow is protected from the others, and it can be proved that if a data flow is leaky bucket constrained, an end-to-end delay bound can be guaranteed. The algorithm of WFQ is very similar to the one of FQ. For each packet, a virtual theoretical departure date will be computed, defined as the departure date if the scheduler was a perfect GPS scheduler. Then, each time the output link is idle, the packet with the smallest date is selected for emission. The pseudo code can be obtained simply from the one of FQ by replacing the computation of the virtual departure time by

packet.virFinish = virStart + packet.size / Ri

with R i = w i ( w 1 + w 2 + . . . + w N ) R {\displaystyle R_{i}={\frac {w_{i}}{(w_{1}+w_{2}+...+w_{N})}}R} .

WFQ as a GPS approximation WFQ, under the name PGPS, has been designed as "an excellent approximation to GPS", and it has been proved that it approximates GPS "to within one packet transmission time, regardless of the arrival patterns." Since WFQ implementation is similar to fair queuing, it has the same O(log(n)) complexity, where n is the number of flows. This complexity comes from the need to select the queue with the smallest virtual finish time each time a packet is sent. After WFQ, several other implementations of GPS have been defined.

Even if WFQ is at most "one packet" late w.r.t. the ideal GPS policy, it can be arbitrarily ahead. The Worst-case Fair Weighted Fair Queueing (WF2Q) fixes it by adding a virtual start of service to each packet, and selects a packet only if its virtual start of service is not less than the current time. The selection of the queue with minimal virtual finish time can be hard to implement at wire speed. Then, other approximations of GPS have been defined with less complexity, like deficit round robin.

History The introduction of parameters to share the bandwidth in an arbitrary way in mentioned at the end of as a possible extension to FQ. The term weighted first appears in.

See also Deficit round robin Fairness measure Max-min fairness Scheduling algorithm Statistical time division multiplexing Weighted round robin

References

Worked examples

Example 1 — a first encounter with Weighted fair queueing

Start with the simplest possible case. Write down what Weighted fair queueing 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 Weighted fair queueing 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 Weighted fair queueing 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 Weighted fair queueing

In research
Weighted fair queueing 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 Weighted fair queueing 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
Weighted fair queueing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Fair division protocols, Network scheduling algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Weighted fair queueing 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 “Weighted fair queueing” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Weighted fair queueing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Weighted fair queueing 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 Weighted fair queueing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Weighted fair queueing in simple terms?

Weighted fair queueing (WFQ) is a network scheduling algorithm. WFQ is both a packet-based implementation of the generalized processor sharing (GPS) policy, and a natural extension of fair queuing (FQ).

Why does Weighted fair queueing 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 Weighted fair queueing?

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 Weighted fair queueing.

Tags

  • Fair division protocols
  • Network scheduling algorithms

Keep exploring