BFair: An Optimal Scheduler for Periodic Real-Time Tasks
description
Transcript of BFair: An Optimal Scheduler for Periodic Real-Time Tasks
![Page 1: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/1.jpg)
BFair: An Optimal Scheduler for Periodic Real-Time Tasks
Hang SuThe University of Texas at San Antonio
http://www.cs.utsa.edu/~hsu/
September 14, 2011
![Page 2: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/2.jpg)
2
Roadmap of This Talk Introduction
Task and system models Traditional scheduling algorithms Performance and utilization bound comparisons
Boundary fair (Bfair) scheduler for periodic tasks Scheduling decision at deadline boundary time of tasks
Simulation and Discussions Reference
![Page 3: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/3.jpg)
3
System Models Periodic task model: task Ti :
Worst case execution time (WCET) ci Period (relative/implicit deadline) pi
Utilization ui = ci / pi ; U = Σ ui is system utilization
pWCET: c
0 2p timeWCET: c
![Page 4: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/4.jpg)
4
Multiprocessor Real-Time Systems Given number of processors: m A set of real-time tasks: Ti (ci, pi); i = 1,…n The scheduling problem: when and where to
execute which task to meet all timing constraints? Objectives to consider
System utilization: U<= m Scheduling overhead: scheduling decision points,
preemption (context switch) points, and task migrations
![Page 5: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/5.jpg)
Scheduling Algorithms on Single Processor EDF (Earliest Deadline First)
Priority Assignment Policy:Always assign highest priority to the task
with earliest deadline Utilization upper bound : 1
U<= 1 Example: T1=(1, 3), T2=(3, 5) (U= 1/3+3/5=14/15)
T1
1
0 time1
T12 T1
2 T12 T2
1
2 3 4 5 6 10
![Page 6: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/6.jpg)
Scheduling Algorithms on Single Processor RMS ( rate-monotonic [1] ) C.L. Liu 73'
Utilization bound:n(21/n-1)
Priority Assignment policy:Always assign highest priority to the task with
smallest period
![Page 7: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/7.jpg)
Example(RMS): T1=(1, 3), T2=(3, 5)
(U= 1/3+3/5=14/15) n(21/n-1)
1*(21/1 - 1 ) = 1 (n=1 )• 2*(21/2 – 1 ) = 2*(1.414... -1) = 0.828... (n=2)
U= 1/3+3/5=14/15 = 0.933 > 0.828
Scheduling Algorithm on Single Processor
T11
1
T12 T1
2 T21 T1
2
2 3 4 5 6 100
T22 T2
2
7 8
T22 T4
1
9
T32T
22
11 12
T51T3
2
12 13
T32
14 15
IDLET31
![Page 8: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/8.jpg)
8
Traditional Approaches and Problems Partitioned scheduling
A subset of tasks one processor; problem reduced to single processor scheduling
(e.g., EDF or RMS) Semi-partitioned: most tasks have fixed
assignment to processors, a few tasks may migrate between processors
better utilization Global scheduling
Single global queue: free processor fetch next highest priority task in the queue
Global EDF and RMS low system utilization
![Page 9: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/9.jpg)
9
Pfair: Proportional Fair SchedulerProportional Fair Scheduler: Sanjoy
Make progress fairly Fully utilized on multiple processors Proportional progress
Allocation for task Ti before time t: x Allocation error: lagi = ui* t – x Fair for task Ti at time t if | lagi | < 1
x is either ui* t or ui* t
![Page 10: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/10.jpg)
Variations of Pfair algorithmsPD [Baruah’95] in [2]
PD2 [Anderson’01] in [4][5]
ER-fair [Anderson’00] in [3]
Pfair: Proportional Fair Scheduler
![Page 11: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/11.jpg)
11
An Example T1=(1, 3), T2=(2, 5), T3=(2, 5), T4=(2, 3), T5=(1, 5) m=U=wi =2, LCM = 15;
PF schedule 15 scheduling points 27 preemptions
Deadline miss only happens at periodic boundaries !
2 1 2 3 1 2 3 1 2 4 1 2 1 2 4
4 3 4 4 5 4 4 4 3 5 4 3 4 3 50 1 2 3 4 5 6 7 8 109 11 12 13 14 15
P2
P1
0 1 2 3 4 5 6 7 8 109 11 12 13 14 15
![Page 12: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/12.jpg)
12
Boundary Fair: A new approach Idea
Schedule ONLY at boundariesBoundary time bk = a * pi , b0=0, bi < bi+1 ; Allocate resources to tasks for the time units within
two consecutive boundaries Maintain fairness at boundary time bk (Bfair)
Ti get either ui* bk or ui* bk Two-step allocation
Mandatory units to keep fairnessOptional units for future urgent tasks
Dakai Zhu
![Page 13: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/13.jpg)
13
The Example: Bfair Schedule T1=(1, 3),
T2=(2, 5), T3=(2, 5), T4=(2, 3), T5=(1, 5)
0 1 2 3 4 5 6 7 8 109 11 12 13 14 15
T1 T2 T3 T4 T5
At boundary time 0: allocate [0 3)
Demand 1 6/5 6/5 2 3/5
Mandatory 1 1 1 2 0
pending 0 1/5 1 /5 0 3/5
Tasks T2, T3,T5 are eligible for the optional unit ?
P2
P1
![Page 14: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/14.jpg)
14
Algorithm for Bfair Scheduler
Define a set of boundaries: {b0, …, bL} bk < bk+1; b0 = 0, bL = LCM; k, Ti, bk is a multiple of pi;
At bk, we allocate [bk , bk+1) Remaining work for Ti before bk
RWik = wi* bk – allocated units for Ti
Mandatory units: mi
k = max{ 0, RWik + wi*(bk+1 – bk) }
Optional units if: m*(bk+1 – bk) > mik
![Page 15: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/15.jpg)
15
Algorithm for Bfair Scheduler (cont.) Eligible tasks
Pending work:PWik=RWi
k + wi*(bk+1 – bk) - mik > 0
Not fully allocated: mik < bk+1 – bk
Dynamic priority: urgency of future Character string: idea from P-fair [Baruah’96]
k(Ti) = sign[bk+1*wi – bk*wi – (bk+1- bk)](Ti, k) = k+1(Ti), …, k+s(Ti)
Minimum s such that k+s(Ti) ‘+’ Time Factor (TF) if k+s(Ti) = ‘–’
TF ik=
1−(bk+sw i−⌊bk+sw i ⌋)w i
![Page 16: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/16.jpg)
16
Algorithm for Bfair Scheduler (cont.)
For eligible tasks Ti and Tj Compare (Ti, k) and (Ti, k)
Character by character: ‘+’ > ‘0’ > ‘–’Bigger string has higher priority
If tie and last character is ‘0’: arbitrary If tie and last character is ‘–’
Compare time factor (TF) smaller time factor has higher priority If tie again: arbitrary, e.g., smaller index
High priority tasks get one optional unit each
![Page 17: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/17.jpg)
17
The Example: Bfair Schedule (cont.) T1=(1, 3), T2=(2, 5),
T3=(2, 5), T4=(2, 3), T5=(1, 5)
0 1 2 3 4 5 6 7 8 109 11 12 13 14 15
T1 T2 T3 T4 T5
pending 0 1/5 1 /5 0 3/5 string * - - * -
* 0 0 * 0 UF
Mandatory 1 1 1 2 0
0 1 0 0 0 Optional
1 2 2
3 4 4
31 2 31 2 4 1 2 1 2
44 5 4 4 43 5 43 4
3
5
Compared BF vs. PF: Scheduling Points: 7 vs. 15Preemptions: 24 vs. 27
P2
P1
![Page 18: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/18.jpg)
Simulations and Discussions
Scheduling Points Execution time at each scheduling point Context switches Task Migrations
![Page 19: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/19.jpg)
Scheduling Points Comparisons
Figure 4 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 20: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/20.jpg)
Scheduling Points Comparisons(con.t)
Figure 5 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 21: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/21.jpg)
Execution time at each scheduling point
Figure 6 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 22: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/22.jpg)
Context Switches
Figure 12 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 23: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/23.jpg)
Context Switches(con.t)
Figure 13 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 24: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/24.jpg)
Task Migrations
Figure 14 and 15 from: Dakai Zhu, Xuan Qi*, An Optimal Boundary-Fair Scheduling Algorithm for Multiprocessor Real-Time Systems, Journal of Parallel and Distributed Systems, May 2011
![Page 25: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/25.jpg)
1. C. L. Liu and James W. Layland. Scheduling algorithms for multiprogramming in a hard real-time environment. J. ACM, 20(1):46–61, 1973.
2. S. K. Baruah, J. Gehrke, and C. G. Plaxton. Fast scheduling of periodic tasks on multiple resources. In Proc. of The International Parallel Processing Symposium, Apr. 1995.
3. J.H. Anderson and A. Srinivasan. Early-release fair scheduling. In Proc. of the 12th Euromicro Conference on Real-Time Systems, Jun. 2000.
4. J.H. Anderson and A. Srinivasan. Mixed pfair/erfair scheduling of asynchronous periodic tasks. In Proc. of the 13th Euromicro Conference on Real-Time Systems, Jun 2001.
5. B. Andersson, S. Baruah, and J. Jonsson. Static-priority scheduling on multiprocessors. In Proc. of The 22th IEEE Real-Time Systems Symposium, pages 193–202, Dec. 2001
Reference
![Page 26: BFair: An Optimal Scheduler for Periodic Real-Time Tasks](https://reader036.fdocuments.in/reader036/viewer/2022062305/568164c3550346895dd6d8c9/html5/thumbnails/26.jpg)
26
Questions and Comments