27
Lottery Scheduling: Flexible Proportional-Share Resource Management Carl A. Waldspurger William E. Weihl MIT Laboratory for Computer Science OSDI ’94

Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Lottery Scheduling:Flexible Proportional-Share

Resource Management

Carl A. Waldspurger William E. Weihl

MIT Laboratory for Computer Science

OSDI ’94

Page 2: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Contents

• Background

• Overview

• Design & Implementation

• Evaluation

• Contribution

• Flaws

2

Page 3: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Background (1)

• Scheduler needs

• Flexibility

• High responsiveness

• Modular

• Robust

• Fine grained

• Low-overhead

• Conceptually-simple

3

Page 4: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Background (2)

• Priority based scheduling is often ad-hoc[1]

• Pretty good for considering all the factors

• Several problems of priority scheduling

• Absolute priority schemes

• Fairness

• Too many parameters make scheduler complicated

• Proportional-share scheduling in network packet

scheduling gets famous

4[1]H.M.Deitel.OperationSystems,Addison-Wesley,1990

Page 5: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Approach to Solve Fairness[1,2]

5[1]G.J.Henry.“TheFairShareScheduler”,AT&TBellLab,1984[2]J.KayandP.Lauder.“AFairScheduler”,CommunicationsoftheACM,1988

• Introduce dynamically controlled priority

• Solve absolute priority problem

• Limitations

• Large overhead

• Response time is bad

Page 6: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Proportional-Share Scheduling

6

• At that time, main issue in packet scheduling in

network is proportional-share scheduling

─ GPS is ideal model

• Importance of fair queueing

─ Problem of WFQ[1]

• Monitoring overhead was high

[1]A.Demersetal.,“Analysisandsimulationofafairqueueingalgorithm

Page 7: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Overview

• Lottery scheduling

• Randomized resource allocation mechanism

• Proportional-share resource management

• Guarantee probabilistic fairness

• Starvation-free

• Low overhead than others

• Simple and elegant with not that much overhead

7

Page 8: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

• In each round, one winner is picked

• Thread with winning ticket gets CPU resource

• Several implementations can exist

• List based structure

• Tree based structure

Design: Lottery

8

Listbasedstructure

Page 9: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

• Each thread receives variable numbers of lottery tickets

• Amount

• The number of tickets that received

• Currency

• Who published lottery tickets?

Design: Lottery Tickets

9

Page 10: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Design: Ticket Currency

10

• Looks like local lottery at each level

• Makes trusty boundaries

• Global load balancing

Page 11: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Design: Balancing Issue (1)

11

• Ticket transfers

• One thread can send a bunch of tickets to another

• Useful in interactive systems

• Eliminate priority inversion problem

• Ticket inflation & deflation

• If more tickets are added, the value of one ticket decreases

• With trusting threads, it can be the key to dynamic balancing

between threads

Page 12: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Design: Balancing Issue (2)

12

• Ticket compensation

• Threads which consumes a fraction f of time quantum

receives 1/f times scheduling until they get lottery

CPU Bound Thread I/O Bound Thread

T T/5

• Usewholetimequantum• Tickets:400

• Use1/5timequantum• f=1/5• Tickets:400->2000(*1/f)

Page 13: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Experiment Environment

• Mach 3.0 microkernel (MK82)

• 25MHz MIPS-based DEC station 5000/125

• Apps

• Dhrystone benchmark

• Monte-Carlo integration

• Multithreaded client-server

• MPEG Video

13

Page 14: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Evaluation

14

Fairness Over Time Controlling Video Rates

• 2 : 1 ticket allocation for 2 threads • 3 video threads with different ticket• At arrow point, change ticket ratio

Page 15: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Contributions

• Simple, flexible, but strong scheduler

• Solve priority inversion and starvation

• Fairness without much overhead

• Dynamically flexible scheduling

• Well support for modular management

• Can adjust resource allocation without explicit communication

by currencies, ticket inflation and deflation

15

Page 16: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Flaws

• Bad response time

• Do not provide responsiveness for interactive systems

• Non-deterministic

• Unsuitable when the programmers may control better

• Probabilistic can not guarantee when the universe of

ticket is small or too big

• Is it really ‘random’ number generator?

• If skewed, it’s critical to entire system

16

Page 17: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (1)

• Stride scheduling[1]

• Select the smallest value

• Pass is advanced by its stride value

• Ties are broken arbitrarily

17[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995

Page 18: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

18

0 1 2 3 4 5 6 7

τ1 pass value 2

τ2 pass value 3

τ3 pass value 6 [2]

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 19: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

19

0 1 2 3 4 5 6 7

τ1 pass value 2

τ2 pass value 3

τ3 pass value 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 20: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

20

0 1 2 3 4 5 6 7

τ1 pass value 2 4

τ2 pass value 3 3

τ3 pass value 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 21: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

21

0 1 2 3 4 5 6 7

τ1 pass value 2 4

τ2 pass value 3 3

τ3 pass value 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 22: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

22

0 1 2 3 4 5 6 7

τ1 pass value 2 4 4

τ2 pass value 3 3 6

τ3 pass value 6 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 23: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

23

0 1 2 3 4 5 6 7

τ1 pass value 2 4 4

τ2 pass value 3 3 6

τ3 pass value 6 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 24: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

24

0 1 2 3 4 5 6 7

τ1 pass value 2 4 4 6

τ2 pass value 3 3 6 6

τ3 pass value 6 6 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 25: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

25

0 1 2 3 4 5 6 7

τ1 pass value 2 4 4 6

τ2 pass value 3 3 6 6

τ3 pass value 6 6 6 6

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 26: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

After Lottery Scheduling (2)

• Stride scheduling[1]

• Task τ1 : tickets = 3, stride = 2

• Task τ2 : tickets = 2, stride = 3

• Task τ3 : tickets = 1, stride = 6

26

0 1 2 3 4 5 6 7

τ1 pass value 2 4 4 6 8 8 8 10

τ2 pass value 3 3 6 6 6 9 9 9

τ3 pass value 6 6 6 6 6 6 12 12

[1]C.A.Waldspurger,“Lotteryandstridescheduling”,MITLabofComputerScience,1995[2]Source:“IntrotoCPUScheduling”ProvidedbyMinsoo Ryu,Hanyang Univ.

Page 27: Flexible Proportional-Share Resource Managementcsl.skku.edu/uploads/ECE5658S17/week4a.pdf · 2017-03-26 · Lottery Scheduling: Flexible Proportional-Share Resource Management Carl

Question?

27