1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

24
1 Comnet 2010 Communication Networks Communication Networks Recitation 4 Recitation 4 Scheduling & Drop Scheduling & Drop Policies Policies

Transcript of 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

Page 1: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

1Comnet 2010

Communication NetworksCommunication Networks

Recitation 4Recitation 4

Scheduling & Drop PoliciesScheduling & Drop Policies

Page 2: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

2Comnet 2010

Queueing BasicsQueueing Basics

• A queue consists of a A queue consists of a scheduling scheduling disciplinediscipline and a and a drop policydrop policy

queued packets

schedulingdiscipline:what packetgets sent next

drop policy: what is dropped uponoverflow

input

Page 3: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

3Comnet 2010

Generalized Processor SharingGeneralized Processor Sharing

• The ideal max-min fair scheduling scheme The ideal max-min fair scheduling scheme – Visit each non-empty queue in turn Visit each non-empty queue in turn – Serve infinitesimal from each Serve infinitesimal from each – GPS is not implement able; we can serve GPS is not implement able; we can serve

only packets only packets

Page 4: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

4Comnet 2010

Weighted Fair QueueingWeighted Fair Queueing

Problem:Problem: We need to serve a whole packet at We need to serve a whole packet at a time.a time.

Solution:Solution: 1.1. Determine what time a packet, Determine what time a packet, pp, would , would

complete if we served flows by GPS. Call complete if we served flows by GPS. Call this the packet’s finish time, F(this the packet’s finish time, F(pp).).

2.2. Serve packets in the order of increasing Serve packets in the order of increasing finish time.finish time.

Page 5: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

5Comnet 2010

WFQ Round -- Virtual TimeWFQ Round -- Virtual Time

• Round number is a real-valued variable Round number is a real-valued variable that increases at a rate inversely that increases at a rate inversely proportional to the number/weight of proportional to the number/weight of active connections active connections

• Updating the number of connections: Updating the number of connections: – A connection becomes active when a packet A connection becomes active when a packet

arrives to an empty queue arrives to an empty queue – A connection becomes inactive when R(A connection becomes inactive when R(tt) > F() > F(pp), ),

where where pp is the last packet served is the last packet served

Page 6: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

6Comnet 2010

Virtual time ExampleVirtual time Example

A L=1 L=2

B L=2

C L=2

0

0.5

1

1.5

2

2.5

3

3.5

4

0 1 2 3 4 5 6 7 8real time

virt

ual t

ime

1/3

1/2

1/3

1

F1=1

F1=2

F1=2

F2=3.5

Page 7: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

7Comnet 2010

Understanding bit by bit WFQ Understanding bit by bit WFQ 4 queues, sharing 4 bits/sec of bandwidth4 queues, sharing 4 bits/sec of bandwidth

Weights : 1:1:1:1

1

1

1

1

6 5 4 3 2 1 0

B1 = 3

A1 = 4

D2 = 2 D1 = 1

C2 = 1C1 = 1

Time

1

1

1

1

6 5 4 3 2 1 0

B1 = 3

A1 = 4

D2 = 2 D1 = 1

C2 = 1C1 = 1

A1B1C1D1

A2 = 2

C3 = 2

Weights : 1:1:1:1

D1, C1 Depart at R=1

A2, C3 arrive

Time

Round 1

C1 = 1

C1 = 1

6 5 4 3 2 1 0

Time

Weights : 1:1:1:1

1

1

1

1

B1 = 3

A1 = 4

D2 = 2 D1 = 1

C2 = 1C1 = 1

A1B1C1D1

A2 = 2

C3 = 2

A1B1C2D2

C2 Departs at R=2

Round 1Round 2

C1 = 1

C1 = 1

C2 = 1

C2 = 1

C2 = 1

Page 8: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

8Comnet 2010

Understanding bit by bit WFQ Understanding bit by bit WFQ 4 queues, sharing 4 bits/sec of bandwidth4 queues, sharing 4 bits/sec of bandwidth

Weights : 1:1:1:1

1

1

1

1

6 5 4 3 2 1 0

A1 = 4

A1B1C1D1

A2 = 2

C3 = 2

A1B1C2D2

D2, B1 Depart at R=3

A1B1C3D2

Time

Round 1Round 2Round 3

Weights : 1:1:1:1

Weights : 1:1:1:1

1

1

1

1

6 5 4 3 2 1 0

B1 = 3

A1 = 4

D2 = 2 D1 = 1

C2 = 1C3 = 2 C1 = 1

C1D1C2B1B1B1D2D2A 1A1A 1A 1

A2 = 2

C3C3A2A2

Departure order for packet by packet WFQ: Sort by finish round of packetsTime

Sort packets

1

1

1

1

6 5 4 3 2 1 0

A1B1C1D1B1 = 3

A1 = 4

D2 = 2 D1 = 1

C2 = 1C1 = 1

A2 = 2

C3 = 2

A1B1C2D2

A1 Depart at R=4

A1B1C3D2A1C3A2A2

Time

Round 1Round 2Round 3Round 4

C3,A2 Departs at R=6

56

B1 = 3

D2 = 2 D1 = 1

C2 = 1C1 = 1C2 = 1

C1 = 1C1 = 1C1 = 1

Page 9: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

9Comnet 2010

Problem with WFQProblem with WFQ

• The large discrepancy between GPS The large discrepancy between GPS and WFQ is WFQ could provide service and WFQ is WFQ could provide service for a session far ahead of GPS. for a session far ahead of GPS.

• This large difference will result in This large difference will result in unstable and less efficient network unstable and less efficient network control algorithms.control algorithms.

Page 10: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

10Comnet 2010

WF2Q - Worst-Case WF2Q - Worst-Case FairFair Weighted Weighted FairFair QueuingQueuing

• Is a packet approximation algorithm of GPS.Is a packet approximation algorithm of GPS.• WFWF22Q provides almost identical service with GPS, the maximum Q provides almost identical service with GPS, the maximum

difference is no more than one packet size. difference is no more than one packet size. • Difference between WFDifference between WF22Q and WFQQ and WFQ

– In a WFQ system, when the server chooses the next packet for In a WFQ system, when the server chooses the next packet for transmission at time transmission at time tt, it selects among all the packets that are , it selects among all the packets that are backlogged at backlogged at tt, and selects the first packet that would complete , and selects the first packet that would complete service in the corresponding GPS. service in the corresponding GPS.

– In a WFIn a WF22Q system, when the server chooses the next packet at time Q system, when the server chooses the next packet at time tt, it chooses only from the packets that have started receiving , it chooses only from the packets that have started receiving service in the corresponding GPS at service in the corresponding GPS at t,t, and chooses the packet and chooses the packet among them that would complete service first in the corresponding among them that would complete service first in the corresponding GPS. GPS.

Page 11: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

11Comnet 2010

WF²Q WF²Q • Packet approximation algorithm of GPS.Packet approximation algorithm of GPS.

• Choosing the packet with the smallest finish Choosing the packet with the smallest finish time among all the packets that have time among all the packets that have already already started servicestarted service in the in the corresponding GPS emulation.corresponding GPS emulation.

Page 12: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

12Comnet 2010

Problem with WFProblem with WF22QQ

• The time complexity of implementing The time complexity of implementing WFWF22Q is high. Because it’s based on a Q is high. Because it’s based on a virtual time function which is defined virtual time function which is defined with respect to the corresponding GPS with respect to the corresponding GPS system. It leads to considerable system. It leads to considerable computational complexity due to the computational complexity due to the need for simulating events in the GPS need for simulating events in the GPS system. system.

Page 13: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

13Comnet 2010

Page 14: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

14Comnet 2010

GPS vs. WFQGPS vs. WFQ

• 5 classes A, B, C, D, E 5 classes A, B, C, D, E

• Weight 2 for class A Weight 2 for class A

• Weight 1 for other classesWeight 1 for other classes

• Link speed: 1 BpsLink speed: 1 Bps

Page 15: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

15Comnet 2010

GPS vs. WFQ (cont.)GPS vs. WFQ (cont.)

• t=0t=0– 2x4Byte packets in A2x4Byte packets in A– 1x3Byte packet in B1x3Byte packet in B

• t=1t=1– 1x2Byte packet in C1x2Byte packet in C– 1x4Byte packet in D1x4Byte packet in D

• t=2t=2– 1x4Byte packet in E1x4Byte packet in E– 1x2Byte packet in A1x2Byte packet in A

Page 16: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

16Comnet 2010

GPS SimulationGPS Simulation

1/3

2/32/5

1/5

1/5

1/51/6 (T-2)

1/6 (T-2)

1/6 (T-2)

1/6 (T-2)

1/3 (T-2)

A

B

D

C

E

0 1 2 T

T(A1) = 10 4/5

T(C1) = 12 4/5

(4-(2/3+2/5))/(1/3) =8 4/5, 8 4/5 +2= 10 4/5

1/3

Page 17: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

17Comnet 2010

Simulation (cont.)Simulation (cont.)

• After 12 4/5 seconds, the status of the After 12 4/5 seconds, the status of the partial transmissions is:partial transmissions is:– 2/3 Bytes of A2 (total size: 4 bytes)2/3 Bytes of A2 (total size: 4 bytes)– 2 1/3 Bytes of B1 (total size: 3 bytes)2 1/3 Bytes of B1 (total size: 3 bytes)– 2 Bytes of D1 (total size: 4 bytes)2 Bytes of D1 (total size: 4 bytes)– 1 4/5 Bytes of E1 (total size: 4 bytes)1 4/5 Bytes of E1 (total size: 4 bytes)

• Next Packet to finish is B1Next Packet to finish is B1

Page 18: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

18Comnet 2010

GPS SimulationGPS Simulation

1 1/3

2/3

2/3

2/31/4 T

1/4 T

1/2T

A

B

D

C

E

… 12.8 16 2/15 T

T(B1) = 16 2/15

T(A2) = 20 2/15

T(D1) = 21 7/15

2

2

2 1/3

1 4/5

2/3

Page 19: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

19Comnet 2010

Simulation (cont.)Simulation (cont.)

After 21 7/15 seconds, the status of the partial transmissions is:– 2/3 Bytes of A3 (total size: 2 bytes)– 3 4/5 Bytes of E1 (total size: 4 bytes)

Next Packet to finish is E1

Page 20: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

20Comnet 2010

GPS SimulationGPS Simulation

2/5

1/5

14/15

A

D

E

… 21.47 22.07 23

T(E1) = 22 1/15

T(A3) = 23

4

3 4/5

2/3

Page 21: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

21Comnet 2010

WFQWFQ

• Order of packets in GPS is:Order of packets in GPS is:A1, C1, B1, A2, D1, E1, A3A1, C1, B1, A2, D1, E1, A3

• WFQ uses the same orderWFQ uses the same order• Departure time is therefore:Departure time is therefore:

T(A1)=4T(A1)=4 T(C1)=6 T(B1)=9 T(C1)=6 T(B1)=9T(A2)=13 T(D1)=17 T(E1)=21T(A2)=13 T(D1)=17 T(E1)=21T(A3)=23T(A3)=23

• In WFIn WF22Q D1 departs before A2Q D1 departs before A2

Page 22: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

22Comnet 2010

Solution with Virtual TimeSolution with Virtual Time

• For few events, we can use virtual time.For few events, we can use virtual time.

• Virtual time gives us WFQ order without Virtual time gives us WFQ order without calculating GPS time.calculating GPS time.

• In the example, we may ignore the In the example, we may ignore the events of a class getting empty, since it events of a class getting empty, since it never refills.never refills.

• V-depart = V-start + size/weightV-depart = V-start + size/weight

Page 23: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

23Comnet 2010

Virtual Time (cont)Virtual Time (cont)

• Virtual time of t=0 is Vt(0)=0Virtual time of t=0 is Vt(0)=0

• Virtual time of t=1 is Vt(1)=1/3Virtual time of t=1 is Vt(1)=1/3

• Virtual time of t=2 is Vt(2)=1/3+1/5=8/15Virtual time of t=2 is Vt(2)=1/3+1/5=8/15

• Departure times:Departure times:– V(A1) = 0 + 4/2 = 2V(A1) = 0 + 4/2 = 2– V(A2) = 2 + 4/2 = 4V(A2) = 2 + 4/2 = 4– V(A3) = 4 + 2/2 = 5V(A3) = 4 + 2/2 = 5

Page 24: 1 Comnet 2010 Communication Networks Recitation 4 Scheduling & Drop Policies.

24Comnet 2010

Virtual Time (cont)Virtual Time (cont)

• Departure times (cont.)Departure times (cont.)– V(B1) = 0 + 3/1 = 3V(B1) = 0 + 3/1 = 3– V(C1) = 1/3 + 2/1 = 2 1/3V(C1) = 1/3 + 2/1 = 2 1/3– V(D1) = 1/3 + 4/1 = 4 1/3V(D1) = 1/3 + 4/1 = 4 1/3– V(E1) = 8/15 + 4/1 = 4 8/15V(E1) = 8/15 + 4/1 = 4 8/15

• Order is: A1, C1, B1, A2, D1, E1, A3Order is: A1, C1, B1, A2, D1, E1, A3