Computer Science Department University of Pittsburgh 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.
Computer Science Department University of Pittsburgh 2 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]
Computer Science Department University of Pittsburgh 3 Problem Scheduling n periodic tasks, each task T i with (c i, p i ) c i, p i are integers (i.e.,multiples of system time unit) Weight: w i = c i / p i ; System U = w i 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;
Computer Science Department University of Pittsburgh 4 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]
Computer Science Department University of Pittsburgh 5 Previous Work (cont.) PF: proportional fairness [Baruah’96] Proportional progress for tasks at ANY time At time t: either w i * t or w i * t Absolute allocation error: less than one time unit Optimal: full utilization, U = m; Variations of P-fair algorithms PD [Baruah’95] PD 2 [Anderson’01] ER-fair [Anderson’00] Scheduling decision at EVERY time unit !
Computer Science Department University of Pittsburgh 6 An Example T 1 =(1, 3), T 2 =(2, 5), T 3 =(2, 5), T 4 =(2, 3), T 5 =(1, 5) m=U= w i =2, LCM = 15; PF schedule [Baruah’96] 15 scheduling points 27 context switches Deadline miss only happens at period boundaries ! R2R2 R1R
Computer Science Department University of Pittsburgh 7 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 b k (B-Fair) T i get either w i * b k or w i * b k Two-step allocation Mandatory units to keep fairness Optional units for future urgent tasks
Computer Science Department University of Pittsburgh 8 The Example T 1 =(1, 3), T 2 =(2, 5), T 3 =(2, 5), T 4 =(2, 3), T 5 =(1, 5) T 1 T 2 T 3 T 4 T 5 At boundary time 0: allocate [0 3) Demand 1 6/5 6/5 2 3/5 Mandatory pending 0 1/5 1 /5 0 3/5 Tasks T 2, T 3,T 5 are eligible for the optional unit ? R2R2 R1R1
Computer Science Department University of Pittsburgh 9 BF Algorithm Define a set of boundaries: {b 0, …, b L } b k < b k+1 ; b 0 = 0, b L = LCM; k, T i, b k is a multiple of p i ; At b k, we allocate [b k, b k+1 ) Mandatory units Optional units m i k = max{ 0, RW i k + w i *(b k+1 – b k ) } RW i k = Remaining work for T i before b k RW i k = w i * b k – allocated units for T i m*(b k+1 – b k ) > m i k
Computer Science Department University of Pittsburgh 10 BF Algorithm (cont.) Eligible tasks Pending work:PW i k =RW i k + w i *(b k+1 – b k ) - m i k > 0 Not fully allocated: m i k < b k+1 – b k Dynamic priority: urgency of future Character string Time Factor (TF) : idea from P-fair [Baruah’96] k (T i ) = sign[b k+1 *w i – b k *w i – (b k+1 - b k )] (T i, k) = k+1 (T i ), …, k+s (T i ) Minimum s such that k+s (T i ) ‘+’ : when k+s (T i ) = ‘–’
Computer Science Department University of Pittsburgh 11 BF Algorithm (cont.) For eligible tasks T i and T j Compare (T i, k) and (T i, 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
Computer Science Department University of Pittsburgh 12 The Example (cont.) T 1 =(1, 3), T 2 =(2, 5), T 3 =(2, 5), T 4 =(2, 3), T 5 =(1, 5) T 1 T 2 T 3 T 4 T 5 pending 0 1/5 1 /5 0 3/5 string * - - * -* 0 0 * 0 TF Mandatory Optional Compared BF vs. PF: Scheduling Points: 7 vs. 15 Context Switches: 24 vs. 27 R2R2 R1R1
Computer Science Department University of Pittsburgh 13 Complexity of BF For each scheduling point: O(n*p max ) Mandatory units allocation: O(n) Optional units: O(n*p max ) Priority compare: O(p max ) Linear selection from ‘n’ tasks: O(n) [Blum’73] Improved BF: O(n); Improve priority comparison: O(1) If k (T i ) = k (T j ) = ‘+’, consider two counter-task with weight of 1-w i and 1-w j, respectively. k (CT i ) = k (CT j ) = ‘-’: compare their time factors (TF) Bigger TF gets higher priority Efficient P-fair: PD has O(min{n, m log n} ) [Baruah’95]
Computer Science Department University of Pittsburgh 14 Number of Scheduling Points Up to 100 tasks Min period: 10 Max period 20 100 LCM 2 32
Computer Science Department University of Pittsburgh 15 Cycles per Scheduling Point Up to 100 tasks Min period: 10 Max period: 100 c i is randomly chosen from 1 to p i ; i.e., m n/2 Conservative implementation
Computer Science Department University of Pittsburgh 16 Total Time to Generate Schedules Up to 100 tasks Min period: 10 Max period: 100 c i is randomly chosen from 1 to p i ; i.e., m n/2
Computer Science Department University of Pittsburgh 17 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
Computer Science Department University of Pittsburgh Multiple-Resource Periodic Scheduling Problem: how much fairness is necessary? Dakai Zhu, Daniel Mossé and Rami Melhem Questions ?
Computer Science Department University of Pittsburgh 19 Analysis of B-Fair Ahead, behind, punctual task sets RW i k 0, =0; respectively Pre-ahead, pre-behind task set PW i k 0; respectively
Computer Science Department University of Pittsburgh 20 Analysis of B-Fair (cont.) No tasks miss the deadline if m (w i ) When allocating [b k, b k+1 ): m = (w i ) No over requirement m i k m*(b k+1 – b k ) Enough eligible tasks At least m*(b k+1 – b k ) – m i k Otherwise, non-empty ahead set and behind set for each previous boundary, which contradicts at b 0
Computer Science Department University of Pittsburgh 21 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 10 3 >14.5% 10 6 >7.24% 10 9 > 5%