Unit 4: The Network Layer — Data Plane

Tutorial 11: Queueing, Scheduling, and QoS Fundamentals

Course: COMP347 Computer Networks (Revision 10)  |  Textbook: Kurose & Ross, Computer Networking: A Top‑Down Approach (9th ed.)

Table of Contents

1. Learning Objectives

Upon completion of this tutorial, students should be able to:

2. Overview

In packet‑switched networks, multiple packets often contend for the same output link. Queueing and scheduling are the mechanisms that determine which packets are transmitted next and which are dropped when the buffer is full. These mechanisms directly impact network performance, including latency, jitter, throughput, and fairness. Quality of Service (QoS) refers to the ability of the network to provide different levels of service to different traffic classes, ensuring that critical applications (e.g., VoIP, video conferencing) receive preferential treatment.

This tutorial covers the fundamentals of queueing and buffering, various scheduling algorithms (FIFO, Priority, Round‑Robin, WFQ), active queue management (RED, WRED, ECN), traffic shaping (token bucket, leaky bucket), and QoS architectures (IntServ, DiffServ). We also discuss congestion effects and advanced topics such as bufferbloat and queueing theory.

3. Detailed Technical and Theoretical Content

3.1 Buffer Management and Queueing Principles

Routers buffer packets when the arrival rate exceeds the transmission rate. Buffers are finite; when a buffer is full, packets must be dropped. The choice of drop policy (tail drop vs. active queue management) and the size of the buffer significantly affect performance.

Key concepts:

The buffer size is often set to the bandwidth‑delay product (BDP) to absorb bursts.

3.2 FIFO (First‑In‑First‑Out) Scheduling

FIFO is the simplest scheduler: packets are transmitted in the order they arrive. It has no concept of priority or fairness. FIFO is easy to implement but can cause head‑of‑line blocking and does not differentiate between traffic classes. It is suitable for networks with homogeneous traffic and no QoS requirements.

3.3 Priority Queueing (PQ)

Priority queueing uses multiple queues, each with a different priority level. Higher‑priority queues are served before lower‑priority ones. This ensures that critical traffic (e.g., VoIP) experiences low delay. However, low‑priority traffic can be starved if high‑priority traffic is heavy. Strict priority queueing is often used with rate limiters to prevent starvation.

3.4 Round‑Robin (RR) and Weighted Round‑Robin (WRR)

Round‑Robin serves each queue in a cyclic order, ensuring fairness among flows. Weighted Round‑Robin assigns weights to queues, allowing different bandwidth allocations. For example, a queue with weight 2 gets twice the service of a queue with weight 1. WRR is simple and provides fairness, but it does not guarantee fair allocation for variable‑length packets (unless byte‑based).

3.5 Weighted Fair Queueing (WFQ)

WFQ is a more sophisticated algorithm that approximates a "fluid" fairness model. It emulates a bit‑by‑bit round‑robin (BRR) by computing a virtual finish time for each packet. WFQ provides strict fairness, ensuring that each flow gets a share of bandwidth proportional to its weight. It also bounds the delay for each flow. However, WFQ is computationally complex.

Key formula (for a single server): Each packet is assigned a virtual finish time based on its arrival time, size, and weight. Packets are transmitted in increasing order of finish times.

3.6 Active Queue Management: RED, WRED, ECN

AQM proactively drops (or marks) packets before the buffer is full to signal congestion to TCP senders, avoiding global synchronization.

3.7 Token Bucket and Leaky Bucket Traffic Shaping

Traffic shaping controls the rate at which traffic is transmitted, smoothing bursts.

3.8 QoS Architectures: Best‑Effort, IntServ, DiffServ

3.9 Congestion Effects and Control Mechanisms

Congestion occurs when the demand exceeds the available capacity. Effects include increased queueing delay, packet loss, and reduced throughput. Congestion control mechanisms (e.g., TCP congestion control, AQM, and rate limiting) work together to manage congestion.

3.10 Advanced Topics: Queueing Theory, QoS in SDN, and Bufferbloat

4. Quiz Section

Multiple‑Choice Questions

Q1. Which scheduling algorithm provides the simplest implementation but offers no fairness or priority?

Show Answer

C) FIFO

Q2. In Priority Queueing, what is the main risk for low‑priority traffic?

Show Answer

A) Excessive delay or starvation

Q3. Which scheduling algorithm approximates a bit‑by‑bit round‑robin and provides fair bandwidth allocation?

Show Answer

C) WFQ

Q4. What does RED stand for?

Show Answer

B) Random Early Detection

Q5. ECN (Explicit Congestion Notification) works by:

Show Answer

B) Marking packets to indicate congestion

Q6. The Leaky Bucket traffic shaper enforces:

Show Answer

A) A constant output rate

Q7. The Token Bucket allows:

Show Answer

B) Bursts up to the bucket capacity

Q8. Which QoS architecture uses RSVP for per‑flow resource reservation?

Show Answer

B) IntServ

Q9. Differentiated Services (DiffServ) uses which field in the IP header?

Show Answer

B) DSCP

Q10. In WFQ, the weight of a queue determines:

Show Answer

B) The share of bandwidth proportional to weight

Q11. Bufferbloat refers to:

Show Answer

B) Excessively large buffers causing high latency

Q12. The average queue length in an M/M/1 queue is given by:

Show Answer

B) L = ρ/(1‑ρ) where ρ = λ/μ.

Q13. Which of the following is NOT a benefit of AQM?

Show Answer

C) Increasing throughput regardless of congestion

Q14. In WRR, if queue A has weight 3 and queue B has weight 1, what fraction of bandwidth does queue A get?

Show Answer

B) 3/4

Q15. The purpose of the min_th and max_th thresholds in RED is to:

Show Answer

B) Determine the drop probability profile

Q16. In a Token Bucket, the average output rate is determined by:

Show Answer

B) The token generation rate

Q17. Which DiffServ Per‑Hop Behavior (PHB) is typically used for best‑effort traffic?

Show Answer

C) BE

Q18. In IntServ, the service model that provides a guaranteed rate and bounded delay is called:

Show Answer

B) Guaranteed Service

Q19. Head‑of‑line (HOL) blocking is a problem associated with:

Show Answer

B) Input queueing

Q20. Which of the following is a disadvantage of Strict Priority Queueing?

Show Answer

A) It can starve lower‑priority traffic

Q21. In an M/M/1 queue, the utilization (ρ) is defined as:

Show Answer

A) λ / μ

Q22. Which scheduling algorithm provides the fairest allocation of bandwidth among competing flows?

Show Answer

C) WFQ

Q23. The Leaky Bucket is often used for:

Show Answer

A) Policing traffic at the network edge

Q24. ECN uses which bits in the IP header?

Show Answer

B) ECN (bits 6 and 7 of the TOS/TC field)

Q25. In RED, the drop probability increases linearly between min_th and max_th. What is the probability at max_th?

Show Answer

B) 1 (all packets are dropped)

Q26. Which QoS architecture is most scalable for large networks?

Show Answer

B) DiffServ

Q27. The main purpose of traffic shaping is to:

Show Answer

B) Smooth traffic bursts and enforce rate limits

Q28. Which of the following is an example of a Per‑Hop Behavior (PHB) in DiffServ?

Show Answer

B) Expedited Forwarding (EF)

Q29. In WFQ, what is the virtual finish time of a packet?

Show Answer

B) A computed value used to order packets for fair transmission

Q30. Bufferbloat is primarily caused by:

Show Answer

B) Overly large buffers combined with TCP's congestion control

Short‑Answer Questions

Q31. Explain the difference between tail drop and RED.

Show Answer

Tail drop discards packets only when the buffer is full, causing global synchronization. RED proactively drops packets probabilistically based on average queue length, signaling congestion earlier and reducing synchronization.

Q32. How does WFQ provide fairness among flows?

Show Answer

WFQ emulates a bit‑by‑bit round‑robin by assigning virtual finish times to each packet based on its arrival time, size, and weight. It transmits packets in increasing finish time order, ensuring each flow receives a share of bandwidth proportional to its weight.

Q33. What is the purpose of the token bucket in traffic shaping?

Show Answer

The token bucket allows traffic to have an average rate (determined by token generation) and a maximum burst (determined by bucket size). It provides flexible rate control while allowing bursts within limits.

Q34. Compare and contrast IntServ and DiffServ.

Show Answer

IntServ provides per‑flow QoS with resource reservation (RSVP), offering guaranteed services but lacking scalability. DiffServ aggregates traffic into classes and applies per‑hop behaviors, using DSCP marking; it is scalable but offers coarse‑grained QoS.

Q35. What is bufferbloat and how can it be mitigated?

Show Answer

Bufferbloat is the high latency caused by oversized buffers in network devices. It can be mitigated by using Active Queue Management (RED, CoDel) and by configuring smaller buffer sizes.

Scenario‑Based Questions

Q36. A router uses FIFO with a buffer of 100 packets. Traffic arrives at a rate of 800 packets/sec and is transmitted at 1000 packets/sec. What is the average queue length? Is this stable?

Show Answer

λ = 800, μ = 1000, ρ = 0.8. Average queue length (M/M/1) = ρ/(1‑ρ) = 0.8/0.2 = 4 packets. Stable because ρ < 1.

Q37. An administrator wants to ensure that VoIP traffic gets low latency and data traffic gets the remaining bandwidth. Which scheduling algorithm should they use and why?

Show Answer

Priority Queueing with VoIP in the high‑priority queue and data in a lower‑priority queue. However, to prevent starvation of data, rate limiting on VoIP or using WRR with high weight for VoIP could be used. Alternatively, DiffServ with EF for VoIP and AF for data.

Q38. A RED router has min_th = 30 packets, max_th = 60 packets, and max_p = 0.1. What is the drop probability when the average queue length is 45 packets?

Show Answer

Drop probability = max_p * (avg - min_th) / (max_th - min_th) = 0.1 * (45‑30)/(60‑30) = 0.1 * 15/30 = 0.05 = 5%.

Q39. A token bucket has a token rate of 1 Mbps and a bucket size of 10 KB. A sender wants to transmit a 20 KB file. How long will it take to send the file (assuming burst possible)?

Show Answer

The bucket can hold up to 10 KB, so the first 10 KB can be sent immediately (burst). The remaining 10 KB must wait for tokens at 1 Mbps, which takes 10 KB / 1 Mbps = 10 * 8 kb / 1000 kbps = 0.08 seconds? Actually, 10 KB = 80 kb. 80 kb / 1000 kbps = 0.08 s. Total = initial burst (negligible) + 0.08 s = 0.08 s.

Q40. Why does WFQ require per‑packet state? How does this affect scalability?

Show Answer

WFQ must track the finish time for each packet, which requires maintaining state per flow or per queue. This increases memory and processing overhead, making WFQ less scalable than simpler algorithms like WRR or FIFO for large numbers of flows.

Q41. A router experiences high jitter for VoIP traffic. Which scheduling change could reduce jitter?

Show Answer

Use Priority Queueing for VoIP or ensure that VoIP traffic is assigned to a low‑delay queue (e.g., with EF PHB in DiffServ). Additionally, using WFQ with low weight for other traffic can provide consistent service.

Q42. Explain how ECN helps in avoiding packet loss during congestion.

Show Answer

ECN marks packets (sets CE bit) instead of dropping them. The receiver echoes this to the sender via TCP ECN‑Echo, and the sender reduces its rate. This avoids retransmissions and reduces latency.

Q43. A network uses strict priority queueing. What happens if high‑priority traffic consumes 90% of the link, and low‑priority traffic is heavy?

Show Answer

Low‑priority traffic will be starved (very high delay or dropped). This is a disadvantage of strict priority; rate limiting high‑priority traffic or using WRR could prevent starvation.

Q44. Why is the average queue length used in RED instead of the instantaneous queue length?

Show Answer

Using the average queue length smoothes out transient bursts and avoids dropping packets unnecessarily during short bursts. It provides a more stable indication of persistent congestion.

Q45. In WRR, if queue 1 has weight 2 and queue 2 has weight 3, and both have packets, what is the bandwidth ratio between queue 1 and queue 2?

Show Answer

Queue 1 gets 2/(2+3) = 40%, queue 2 gets 3/(2+3) = 60%. Ratio = 2:3.

Q46. What is the role of policing vs. shaping in traffic management?

Show Answer

Policing drops or marks packets that exceed a rate limit, applied at the ingress. Shaping buffers excess traffic to smooth it out, applied at the egress. Shaping introduces delay but no loss; policing may cause loss.

Q47. How does DiffServ handle traffic classification?

Show Answer

DiffServ marks packets with a DSCP value at the edge. Intermediate routers use the DSCP to select a PHB (e.g., EF, AF) and apply appropriate queueing and scheduling.

Q48. A link has a capacity of 10 Mbps. WFQ is used with three flows: weights 1, 2, and 3. What are the guaranteed rates for each?

Show Answer

Total weight = 1+2+3=6. Rates: 10/6*1 = 1.67 Mbps, 10/6*2 = 3.33 Mbps, 10/6*3 = 5 Mbps.

Q49. What is the difference between the leaky bucket and the token bucket?

Show Answer

The leaky bucket enforces a constant output rate, dropping packets that exceed the buffer. The token bucket allows bursts up to the bucket size and enforces an average rate, but does not drop packets (they wait for tokens).

Q50. Why is WFQ considered to provide better fairness than WRR for variable‑length packets?

Show Answer

WRR (packet‑based) can be unfair because larger packets get more bandwidth than smaller ones in a round. WFQ uses bit‑by‑bit round‑robin (or virtual finish times) to ensure that each flow gets its fair share regardless of packet size.

5. Exercise Section

Exercise 1

Calculate the average queue length and average waiting time in an M/M/1 queue with arrival rate λ = 500 packets/sec and service rate μ = 800 packets/sec.

Show Solution

ρ = λ/μ = 500/800 = 0.625. L = ρ/(1‑ρ) = 0.625/0.375 = 1.667 packets. W = 1/(μ‑λ) = 1/(800‑500) = 1/300 = 0.00333 s = 3.33 ms.

Exercise 2

A router uses Priority Queueing with 3 classes: High (VoIP), Medium (Video), Low (Data). High has 10% of traffic, Medium 30%, Low 60%. If the link is 100 Mbps, and all queues are full, what is the maximum rate for each class? What is the issue?

Show Solution

Strict priority: High gets up to 100 Mbps, Medium gets nothing if High is busy, Low gets nothing if High or Medium are busy. This can starve Medium and Low. To prevent starvation, rate limiters should be used.

Exercise 3

Given RED parameters: min_th = 20, max_th = 40, max_p = 0.2. What is the drop probability when the average queue length is 30?

Show Solution

p = max_p * (avg - min_th) / (max_th - min_th) = 0.2 * (30‑20)/(40‑20) = 0.2 * 10/20 = 0.1 = 10%.

Exercise 4

A token bucket has rate r = 2 Mbps, bucket size b = 1 MB. A source sends a file of 5 MB. How long will it take to send the file if the bucket is initially full? What is the average throughput?

Show Solution

Burst = 1 MB at start, remaining 4 MB at 2 Mbps = 4 MB / 2 Mbps = 4*8 Mb / 2 Mbps = 16 seconds. Total time = 1 MB burst (negligible time) + 16 s = 16 s (plus a small burst time). Average throughput = 5 MB / 16 s = 0.3125 MB/s = 2.5 Mbps? Actually 5 MB = 40 Mb, 40 Mb / 16 s = 2.5 Mbps. But the token rate is 2 Mbps, so the average is 2 Mbps. Wait: 5 MB / 16 s = 0.3125 MB/s = 2.5 Mbps, which exceeds 2 Mbps because of the burst. The average over long time is 2 Mbps.

Exercise 5

Compare FIFO, Priority Queueing, and WFQ in terms of: (a) Fairness, (b) Implementation complexity, (c) Delay guarantees.

Show Solution

FIFO: no fairness, simple, no guarantees. Priority: unfair (starvation), moderately complex, guarantees low delay for high priority. WFQ: fair, complex, provides bounded delay and rate guarantees.

Exercise 6

In WFQ, if there are 4 flows with weights 1, 2, 3, 4, and the link capacity is 10 Mbps, what are the guaranteed bandwidths?

Show Solution

Total weight = 10. Rates: 1/10*10=1 Mbps, 2/10*10=2 Mbps, 3/10*10=3 Mbps, 4/10*10=4 Mbps.

Exercise 7

Explain how ECN works in conjunction with RED. What are the benefits?

Show Solution

RED is configured to mark packets instead of dropping when congestion is detected (by setting the CE bit). The receiver echoes this to the sender via TCP ECN‑Echo, and the sender reduces rate. Benefits: no packet loss, less retransmission, lower latency.

Exercise 8

A leaky bucket has a capacity of 10 packets and leaks at 1 packet per second. If 20 packets arrive in a burst, how many are dropped? How long does it take to drain?

Show Solution

Bucket capacity 10, so 10 packets are dropped (the excess). The remaining 10 packets leak at 1 packet/s, taking 10 seconds to drain.

Exercise 9

Design a DiffServ policy for a network with three traffic classes: Voice (low delay, low jitter), Video (high bandwidth, moderate delay), and Best‑Effort (data). Assign DSCP values and describe PHBs.

Show Solution

Voice: EF (Expedited Forwarding, DSCP 46), Video: AF4 (Assured Forwarding class 4 with low drop precedence), Best‑Effort: default (DSCP 0). Use PQ for EF and WRR for AF classes.

Exercise 10

Given an M/M/1 queue with arrival rate 200 pps and service rate 250 pps, what is the probability that the queue has more than 5 packets? (Use formula P(N>n) = ρ^(n+1)).

Show Solution

ρ = 200/250 = 0.8. P(N > 5) = ρ^6 = 0.8^6 = 0.262144.

Exercise 11

Compare the leaky bucket and token bucket in terms of burst tolerance.

Show Solution

Leaky bucket: no burst tolerance; constant rate. Token bucket: allows bursts up to bucket size; average rate is token rate.

Exercise 12

How does weighted round‑robin differ from strict priority queueing?

Show Solution

WRR provides a weighted share of bandwidth to each queue; no queue is starved. Strict priority gives absolute priority to higher‑priority queues, which can starve lower‑priority ones.

Exercise 13

An RED router has min_th=15, max_th=45, max_p=0.15. What is the drop probability at avg=30? At avg=10? At avg=50?

Show Solution

At 30: p = 0.15*(30‑15)/(45‑15)=0.15*15/30=0.075=7.5%. At 10 (below min_th): p=0. At 50 (above max_th): p=1 (all dropped).

Exercise 14

IntServ uses RSVP for signaling. What are the advantages and disadvantages of IntServ compared to DiffServ?

Show Answer

Advantages: per‑flow QoS, guaranteed services. Disadvantages: scalability (state per flow), complexity. DiffServ is scalable but coarse.

Exercise 15

A network admin wants to limit a particular user's traffic to 1 Mbps average with bursts up to 2 MB. Design a token bucket configuration.

Show Solution

Token rate r = 1 Mbps. Bucket size b = 2 MB = 16 Mb. The bucket can hold 16 Mb, allowing bursts up to 2 MB while average is 1 Mbps.

6. Homework Section

Homework 1

Research the history of Active Queue Management. Write a 500‑word essay covering RED, ECN, and CoDel.

Show Sample Answer

RED was introduced by Floyd and Jacobson in 1993. ECN (RFC 3168) added marking. CoDel (Controlled Delay) is a newer AQM that uses queuing delay as a metric. Each has contributed to reducing bufferbloat and improving TCP performance.

Homework 2

Explain the concept of "fairness" in queueing. How do WRR and WFQ achieve fairness? What are the trade‑offs?

Show Sample Answer

Fairness means each flow gets an equal or weighted share of bandwidth. WRR achieves fairness by serving queues cyclically with weights, but is packet‑size dependent. WFQ achieves bit‑level fairness using virtual finish times, but is more complex.

Homework 3

Describe the Integrated Services (IntServ) architecture, its components, and the RSVP protocol. Discuss its scalability issues.

Show Sample Answer

IntServ uses RSVP for signaling, providing guaranteed and controlled‑load services. It maintains per‑flow state in routers, which does not scale to large networks.

Homework 4

Compare and contrast DiffServ and IntServ. Which one is more suitable for the Internet core and why?

Show Sample Answer

DiffServ is more suitable for the Internet core because it aggregates traffic and is scalable. IntServ is better suited for enterprise networks with limited flows.

Homework 5

Design a QoS policy for a corporate network with VoIP, video conferencing, web browsing, and file transfers. Justify your scheduling and marking choices.

Show Sample Answer

VoIP: EF, high priority queue (strict priority or high weight). Video: AF4, WRR with moderate weight. Web: AF1. File transfers: Best‑Effort. Use rate limiting on priority queues to prevent starvation.

Homework 6

Explain the concept of "bufferbloat" and describe how AQM techniques like RED and CoDel address it.

Show Sample Answer

Bufferbloat is high latency due to oversized buffers. RED drops early to keep queues small; CoDel uses queuing delay to mark/drop packets, reducing latency.

Homework 7

Calculate the maximum burst size for a token bucket with rate r=2 Mbps and bucket size b=1 MB. If a burst of 1.5 MB arrives, what happens?

Show Solution

Max burst = b = 1 MB. A 1.5 MB burst: first 1 MB is sent immediately, remaining 0.5 MB waits for tokens at 2 Mbps, taking 0.5 MB / 2 Mbps = 4 Mb / 2 Mbps = 2 seconds.

Homework 8

Write a detailed explanation of the Weighted Fair Queueing algorithm, including how virtual finish times are computed.

Show Sample Answer

WFQ uses a fluid model: each flow has a weight. The algorithm computes a virtual time and assigns each packet a finish time = max(virtual arrival time, previous finish time) + packet size / weight. Packets are transmitted in increasing finish time.

Homework 9

Discuss the role of queuing and scheduling in providing Quality of Service. How do they interact with congestion control mechanisms?

Show Sample Answer

Queueing and scheduling determine per‑packet delay and loss. Congestion control (e.g., TCP) reacts to loss/ECN. AQM and scheduling together provide differentiated QoS and signal congestion.

Homework 10

Research the different Per‑Hop Behaviors (PHBs) in DiffServ: EF, AF, and BE. Describe the recommended use cases for each.

Show Sample Answer

EF: low delay, low loss (VoIP). AF: assured bandwidth with drop precedence (video, business data). BE: best effort (web, email).

Homework 11

Explain how ECN interacts with TCP. What are the benefits of using ECN over RED alone?

Show Sample Answer

TCP uses ECN‑Echo and CWR flags. Benefits: avoids loss, reduces retransmissions, lowers latency, and maintains high throughput.

Homework 12

An M/M/1 queue has arrival rate 300 pps and service rate 400 pps. What is the probability that the queue length exceeds 10 packets? What is the average waiting time?

Show Sample Answer

ρ = 0.75. P(N>10) = ρ^11 = 0.75^11 ≈ 0.0422. W = 1/(400‑300) = 0.01 s = 10 ms.

Homework 13

Compare the performance of Strict Priority Queueing and Weighted Fair Queueing in terms of delay for high‑priority traffic and fairness for low‑priority traffic.

Show Sample Answer

Strict priority gives low delay to high‑priority but can starve low‑priority. WFQ provides guaranteed bandwidth and delay bounds for all traffic, but high‑priority traffic may experience slightly higher delay than strict priority.

Homework 14

Describe the leaky bucket algorithm and its applications in policing. What are the limitations?

Show Sample Answer

Leaky bucket enforces constant output rate. Applications: policing traffic at network edge. Limitations: no burst tolerance, drops excessive traffic.

Homework 15

Discuss the future of QoS in the era of SDN and programmable data planes. How can SDN enable more dynamic QoS?

Show Sample Answer

SDN controllers can program flow tables with custom QoS policies, adapt to real‑time traffic conditions, and allocate bandwidth dynamically. P4 can implement custom scheduling algorithms.

7. Summary

This tutorial has provided a comprehensive exploration of queueing, scheduling, and QoS fundamentals. Key takeaways:

Understanding these principles is essential for designing and operating high‑performance networks. In the next tutorial, we will cover data‑plane security and operational considerations.