09.scheduling Proportional Share
09.scheduling Proportional Share
1
Review
2
Proportional Share Scheduler
Every job has a weight, and jobs receive a share of the available
resources proportional to the weight of every job.
Example
There are two processes, A and B.
Process A has 75 tickets → receive 75% of the CPU
Example
There are 100 tickets
Process A has 75 tickets: 0 ~ 74
Resulting scheduler: A B A A B A A A A A A B A B A
Advantages?
Automatically balances CPU time across processes
Easy to prioritize processes (giving more or less tickets) and priorities can
change via ticket inflation
Disadvantages?
Non deterministic: It occasionally will not deliver the exact right proportion,
especially over short time scales
Ticket currency
A user allocates tickets among their own jobs in whatever currency they
would like.
The system converts the currency into the correct global value.
Example
There are 200 tickets (Global currency)
Ticket transfer
A process can temporarily hand off its tickets to another process.
Ticket inflation
A process can temporarily raise or lower the number of tickets is owns.
If any one process needs more CPU time, it can boost its tickets.
Stride scheduling
Each process is given some tickets
Scheduler chooses process with the lowest pass value to run next
11
Stride Scheduling Example
0 0 0 A
100 0 0 B
100 200 0 C
100 200 40 C
100 200 80 C
100 200 120 A
200 200 120 C
200 200 160 C
200 200 200 …
13
Case Study: Linux Schedulers
14
Case Study: Linux Schedulers
15
Completely Fair Scheduler (more details)
Used for time slice calculation and also weighted updation of vruntime
Jobs that go wake up after long sleep or I/O can monopolize. To avoid
that, CFS sets the vruntime of that job to the min value found in tree.
17