210 likes | 368 Views
Multiple-Resource Periodic Scheduling Problem: how much fairness is necessary?. Dakai Zhu , Daniel Moss é and Rami Melhem. The work is supported by DARPA through the PARTS project. Preface. Power-aware computing for parallel systems Frame based task sets Shared Memory Systems
E N D
Multiple-Resource Periodic Scheduling Problem: how much fairness is necessary? Dakai Zhu, Daniel Mossé and Rami Melhem The work is supported by DARPA through the PARTS project.
Preface • Power-aware computing for parallel systems • Frame based task sets • Shared Memory Systems • Traditional AND-model applications: TPDS’03 • AND/OR-model applications: to appear in TPDS • Distributed Systems: IPDPS’03 • Periodic task sets • Global scheduler: P-fair [Baruah’96] www.cs.pitt.edu/PARTS
Problem • Scheduling • n periodic tasks, each task Ti with (ci, pi) • ci, pi are integers (i.e.,multiples of system time unit) • Weight: wi = ci/ pi; System U = wi • m resources (m U) • Constraints: at any time • One resource one task (resources are not shareable) • One task occupies one resource (tasks are not parallel) • Optimal • Full utilization (U = m); • Scheduling overhead; • Number of Context switches; www.cs.pitt.edu/PARTS
Previous Work • EDF/RM: dynamic/static priority • Optimal for single resource • The famous task set [Dhall’78] • (n –1) tasks with (2*, 1); 1 task with (1, 1+ ) • U = (2*(n-1) + 1/(1+ ) )/n 0 with big n • Harmonic tasks: periods are multiples of each other • [Mancini’94] and [Khemka’97] www.cs.pitt.edu/PARTS
Previous Work (cont.) • PF: proportional fairness [Baruah’96] • Proportional progress for tasks at ANY time • At time t: eitherwi* t or wi* t • Absolute allocation error: less than one time unit • Optimal: full utilization, U = m; • Variations of P-fair algorithms • PD [Baruah’95] • PD2[Anderson’01] • ER-fair [Anderson’00] Scheduling decision at EVERY time unit ! www.cs.pitt.edu/PARTS
2 1 2 3 1 2 3 1 2 4 1 2 1 2 4 R1 4 3 4 4 5 4 4 4 3 5 4 3 4 3 5 R2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 [Baruah’96] • 15 scheduling points • 27 context switches Deadline miss only happens at period boundaries ! www.cs.pitt.edu/PARTS
B-Fair: A new approach • Idea • Schedule ONLY at period boundaries • Allocate resources to tasks for the time units within two consecutive boundaries • Maintain fairness at boundary time bk (B-Fair) • Ti get either wi* bk or wi* bk • Two-step allocation • Mandatory units to keep fairness • Optional units for future urgent tasks www.cs.pitt.edu/PARTS
16/5 6/5 2 3/5 Demand 11 1 2 0 Mandatory 01/5 1 /5 0 3/5 pending ? Tasks T2, T3,T5are eligible for the optional unit The Example • T1=(1, 3),T2=(2, 5),T3=(2, 5),T4=(2, 3),T5=(1, 5) At boundary time 0: allocate [0 3) T1 T2 T3 T4 T5 R1 R2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 www.cs.pitt.edu/PARTS
BF Algorithm • 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) • Mandatory units • Optional units • mik = max{ 0, RWik + wi*(bk+1 – bk) } • RWik = Remaining work for Ti before bk • RWik = wi* bk – allocated units for Ti • m*(bk+1 – bk) > mik www.cs.pitt.edu/PARTS
: 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) ‘+’ • : when k+s(Ti) = ‘–’ BF Algorithm (cont.) • Eligible tasks • Pending work:PWik=RWik + wi*(bk+1 – bk) -mik> 0 • Not fully allocated: mik < bk+1 – bk • Dynamic priority: urgency of future • Character string • Time Factor (TF) www.cs.pitt.edu/PARTS
BF Algorithm (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 www.cs.pitt.edu/PARTS
11 1 2 0 Mandatory 1 2 2 string * - -* - 01/5 1 /5 0 3/5 pending 3 4 4 TF * 0 0* 0 Optional 0 1 00 0 1 3 2 1 2 3 4 1 2 1 2 3 4 5 4 3 4 4 5 3 4 4 4 5 The Example (cont.) • T1=(1, 3),T2=(2, 5),T3=(2, 5),T4=(2, 3),T5=(1, 5) T1 T2 T3 T4 T5 Compared BF vs.PF: Scheduling Points: 7 vs.15 Context Switches: 24 vs.27 R1 R2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 www.cs.pitt.edu/PARTS
Complexity of BF • For each scheduling point: O(n*pmax) • Mandatory units allocation: O(n) • Optional units: O(n*pmax) • Priority compare: O(pmax) • Linear selection from ‘n’ tasks: O(n) [Blum’73] • Improved BF: O(n); • Improve priority comparison: O(1) • If k(Ti) = k(Tj) = ‘+’, consider two counter-task with weight of 1-wi and 1-wj, respectively. • k(CTi) = k(CTj) = ‘-’: compare their time factors (TF) • Bigger TF gets higher priority • Efficient P-fair: PD has O(min{n, m log n} ) [Baruah’95] www.cs.pitt.edu/PARTS
Number of Scheduling Points • Up to 100 tasks • Min period: 10 • Max period • 20 100 • LCM 232 www.cs.pitt.edu/PARTS
Cycles per Scheduling Point • Up to 100 tasks • Min period: 10 • Max period: 100 • ci is randomly chosen from 1 to pi ; i.e., m n/2 • Conservative implementation www.cs.pitt.edu/PARTS
Total Time to Generate Schedules • Up to 100 tasks • Min period: 10 • Max period: 100 • ci is randomly chosen from 1 to pi ; i.e., m n/2 www.cs.pitt.edu/PARTS
Conclusion • Notion of boundary-fairness • BF is optimal: full system utilization • Fewer scheduling points than P-fair algorithms • Complexity per scheduling point is O(n) • Comparable to PD: O (min {n, m log n} ) • Less total time to generate schedules • Compared with PD: less than 100 tasks www.cs.pitt.edu/PARTS
? Questions Multiple-Resource Periodic Scheduling Problem: how much fairness is necessary? Dakai Zhu, Daniel Mossé and Rami Melhem
Analysis of B-Fair • Ahead, behind, punctual task sets • RWik < 0, > 0, =0; respectively • Pre-ahead, pre-behind task set • PWik < 0, > 0; respectively www.cs.pitt.edu/PARTS
Analysis of B-Fair (cont.) • No tasks miss the deadline if m (wi) • When allocating [bk , bk+1): m = (wi) • No over requirement • mik m*(bk+1 – bk) • Enough eligible tasks • At least m*(bk+1 – bk) – mik • Otherwise, non-empty ahead set and behind set for each previous boundary, which contradicts at b0 www.cs.pitt.edu/PARTS
Performance Evaluation (cont.) • Generally, prime number points are not scheduling point for B-Fair • Prime number theory: big number x • x / ln(x) prime numbers smaller than x • LCM: > 1/lnLCM • 103 >14.5% • 106 >7.24% • 109 > 5% www.cs.pitt.edu/PARTS