Professional Documents
Culture Documents
- Tell us where you are, and how much longer you need.
- We will give short extensions to people who dont abuse this
3/37
4/37
Multimedia applications
6/37
request
tkt
server
response
8/37
request
tkt
server
response
8/37
Compensation tickets
What if process only uses fraction f of quantum?
- Say A and B have same number of lottery tickets
- E.g., process A should have had 1/3 of CPU yet after 1 minute
has had only 19 seconds
(nk) pk (1
p)nk
p = fraction tickets
owned, (nk)
n!
( k!( n k) !)
10/37
3 tickets
2 tickets
1 ticket
stride1 = 6
Pass Value
15
10
0
0
10
Time (quanta)
12/37
13/37
- After 99 quanta, one of them still will not have gotten CPU
13/37
10
10
Error (quanta)
Simulation results
0
0
200
400
600
800
1000
20
40
60
80
100
14/37
15/37
- Now
20
3 tickets
2 tickets
1 ticket
stride1 = 6
15
at time 0
10
0
0
15/37
On ticket transfer:
c->tickets = new_tickets;
c->stride = stride1 / c->tickets
int remain = c->pass - global_pass
remain *= new_stride / old_stride
c->pass = global_pass + remain
stride
pass
global_pass
done
remain
remain
global_pass
new_stride
new_pass
16/37
Sleep/wakeup
Process might use only fraction f of quantum
- Just increment c->pass += f * c->stride
17/37
Sleep/wakeup
Process might use only fraction f of quantum
- Just increment c->pass += f * c->stride
18/37
18/37
4
256
2
512
1
1024
3
14
73
512
768
1024
1280
1024
1536
2
512
1
1024
10
1
1024
7
10
102
1024
1536
1
1024
14
2
512
1
1024
5
204 714
306 816
408 918
510 1020
612 1122
1024
1536
8
128
1
1024
12
1
1024
13
256 768
384 896
512 1024
640 1152
7
146
1,2,4,6,
8,9,11
19/37
BVT [Duda]
Borrowed Virtual Time (BVT)
Goals:
20/37
Process weights
Each proc. is faction of CPU determined by weight wi
- Just like tickets in stride scheduling
BVT example
180
gcc
bigsim
160
virtual time
140
120
100
80
60
40
20
0
0
12
15
18
21
24
27
real time
Sleep/wakeup
As with stride, must lower priority after wakeup
- Otherwise process w. very low Ai would starve everyone
gcc
bigsim
350
300
250
200
150
100
50
0
0
15
30
Real-time threads
Also want to support soft real-time threads
- E.g., mpeg player must run every 10 clock ticks
Recall Ei = Ai (warpi ? Wi : 0)
Running warped
120
gcc
bigsim
mpeg
100
80
60
40
20
0
20
40
60
0
10
15
20
25
gcc
bigsim
mpeg
100
80
60
40
20
0
20
40
60
0
10
15
20
25
Google example
Common queries 150 times faster than uncommon
- Have 10-thread pool of threads to handle requests
28/37
SMART [Nieh]
Proposed by Nieh & Lam in 1997
Goals:
- Support soft real-time constraints
29/37
31/37
SMART Algorithm
If most important ready task (ready task with best
value-tuple) is conventional (not real-time), run it
Consider all real-time tasks with better value-tuples
than the best ready conventional task
For each such RT task, starting from the best
value-tuple
- Can you run it without missing deadlines of tasks w. better
value-tuples?
Yes? Add to schedulable set
- Run task with earliest deadline in schedulable set
Current Linux
Linux currently has pluggable scheduling [LWN]
Global linked list of struct sched class
CFS
Quantum depends on # of runnable processes,
determined by parameters set in /proc/sys/kernel:
- sched latency ns: How often processes should run
- sched min granularity ns: Minimum quantum
sched latency
- Quantum = max
# runnable , sched min granularity ns
34/37
Distributed scheduling
Say you have a large system of independent nodes
Postscript
In principle, scheduling decisions can be arbitrary &
shouldnt affect programs results
- Good, since rare that the best schedule can be calculated