Title: A Hierarchical CPU Scheduler for Multimedia Operating Systems
1A Hierarchical CPU Scheduler for Multimedia
Operating Systems
- EE202A, Fall 2001
- Prof. Mani Srivastava
- Hanbiao Wang, Arun Somasundara
2Motivation
- Various application classes (hard real-time,
soft real-time, best efforts) in multimedia
system need different scheduling algorithms - Hierarchical CPU scheduling supports different
scheduling algorithms for different application
as well as protects application classes from one
another
3Framework
- A tree structure, each node has a weight and a
scheduler - Each leaf node represents an aggregation of
threads, and hence an application class - Each non-leaf node represents an aggregation of
application classes
4Framework Example
5Requirements of Scheduling at Non-leaf Nodes
- Fairness among child nodes
- No a priori knowledge of time duration a task
executes before blocked - Bounds on minimum throughput and maximum delay
- Computationally efficient
6Start-time Fair Queuing (SFQ)Notation
rf weight of thread f
qjf jth quantum of thread f
ljf length of qjf in unit of instructions
A(qjf) qjf request time. Its transition time when f block-gtrunnable otherwise, its time at which fs previous quantum finishes
Sf start tag for thread f
Ff finish tag for thread f
v(t) virtual time at time t
7SFQ Algorithm
- Virtual time v(t)
- Initially 0
- Start tag of the thread in service, when the CPU
is busy at time t - Maximum finish tag assigned to any thread, when
the CPU is idle at time t
8SFQ Algorithm contd.
- Start tag Sf
- Sf maxv(A(qjf)), Ff, stamped to thread f when
qjf is requested - Finish tag Ff
- Initially 0
- Ff Sf ljf/rf, incremented when qjf finishes
execution - Threads serviced in increasing order of start
tags ties broken arbitrarily
9SFQ Scheduling Example
- rArB 12
- qA qB 10ms
- lA lB 10
10SFQ Properties
- Fair allocation of CPU regardless of bandwidth
variation. Any threads f, m - Wf(t1,t2)/rf Wm(t1,t2)/rm ? lfmax/rf
lmmax/rm - Wx(t1,t2) is the aggregate work done by CPU in
interval t1,t2 for thread x, lxmax is the
maximum length of quantum for which thread x is
scheduled - No need of a priori knowledge of the quantum
length since scheduling relies on increasing
order of start tags
11SFQ Properties contd.-Bounds on throughput and
delay
- Interrupted CPU modeled as Fluctuation
Constrained server (FC) with average rate C
(instructions/sec) and burstiness ?(C)
(instructions), effective bandwidth - W(t1, t2) ? C (t2 - t1) - ?(C)
- Throughput of thread f (rf)is also FC
- (rf, rf (?nlnmax ?(C) ) / C lfmax)
- Execution Complete Time of qjf
- L(qjf) ? EAT(qjf)(?n?flnmaxljf ?(C))/C
- where EAT(qjf) maxA(qjf),EAT(qj-1f)lj-1f/rf
12SFQ Properties contd.-Bounds on throughput and
delay
- Interrupted CPU modeled as Exponentially Bounded
Fluctuation (EBF) server with (C, B, ?, ?(C)),
effective bandwidth distribution - PW(t1, t2) lt C (t2 - t1) - ?(C) - ? ? Be-??
- Throughput of thread f (rf)is also EBF
- (rf, B, rf ? /C, rf (? nlnmax ?(C)) / C
lfmax) - Execution Complete Time of qjf
- PL(qjf) ? EAT(qjf)(?n?flnmaxljf?(C) ?)/C
- ? 1 - Be- ??
13Implementation
- SFQ Scheduling is used for intermediate nodes
(non-leaf) - Leaf nodes can use any algorithm
- Each node
- Weight, start tag, finish tag
- Each non-leaf node
- list of child nodes
- list of runnable child nodes sorted by start tags
- virtual time of the child node having the minimum
start tag - Each leaf node
- pointer to a function (Scheduling for thread).
14Implementation contd.
- some functions
- hsfq_mknod, hsfq_parse, hsfq_move,
- hsfq_rmnod (only if no child nodes),
- hsfq_admin, hsfq_schedule, hsfq_update (start
and finish tags of all ancestors updated),
hsfq_setrun, hsfq_sleep - Priority inversion
- Not done between classes
- Only within the same leaf
- if rate monotonic, Priority inheritance
- if SFQ transferring weights of blocked to the
blocking thread.
15Implementation contd.
16Experimental Results
- Framework
- Sun SPARCstation 10 with 32MB RAM.
- Multiuser mode
- all system processes running
- Dhrystone benchmark
- Scheduling structure
17Experimental Results contd.
- Achieves predictable resource allocation
- Throughputs of 5 threads running both schemes..
18Experimental Results contd.
- Scheduling overhead
- impact of more threads
- impact of depth
19Experimental Results contd.
- Achieves fair allocation
- nodes isolated from each other and throughput
depends only on weight.
20Experimental Results contd.
- Fair allocation when bandwidth is dynamically
changed
21Related Work
- Weighted Fair Queuing (WFQ)
- not fair when bandwidth fluctuates
- Requires length of quantums to be known a priori
- Computation of round number expensive
- Fair Queuing based on Start-time (FQS)
- modification of WFQ, when quantums not known
- increasing order of start tags
- computationally expensive
- does not provide fairness when bandwidth
fluctuates
22Related Work contd.
- Self Clocked Fair Queuing (SCFQ)
- Approximates round number with finish tag
- increasing order of finish tags
- larger delay guarantee than SFQ
- Lottery Scheduling
- Fairness only over large time intervals
- Supports hierarchical partitioning but
- only one scheduling algorithm
- computational overhead.
23Conclusion
- Enables co-existence of heterogeneous schedulers
- Protects application classes from each other
- Computationally efficient
24References
- P. Goyal, X. Guo, and H. M. Vin. A Hierarchical
CPU Scheduler for Multimedia Operating Systems.
Operating Systems Review, vol.30, spec. issue.,
(Second USENIX Symposium on Operating Systems
Design and Implementation (OSDI), Seattle, WA,
USA, 28-31 Oct. 1996.) ACM, 1996. p.107-21. - P. Goyal, H. M. Vin, and H. Cheng. Start-time
Fair Queuing A Scheduling Algorithm for
Integrated Services Packet Switching Networks.
Proceedings of ACM SIGCOMM96, pages 157-168,
August 1996.