Presentation is loading. Please wait.

Presentation is loading. Please wait.

Anand Srinivasan Department of Computer Science

Similar presentations


Presentation on theme: "Anand Srinivasan Department of Computer Science"— Presentation transcript:

1 Efficient and Flexible Fair Scheduling of Real-time Tasks on Multiprocessors
Anand Srinivasan Department of Computer Science University of North Carolina at Chapel Hill

2 What is a Real-time System?
A system with a dual notion of correctness: Logical correctness (“it does the right thing”). Temporal correctness (“it does it on time”). 4/29/2019 Anand Srinivasan

3 What is a Real-time System?
A system with a dual notion of correctness: Logical correctness (“it does the right thing”). Temporal correctness (“it does it on time”). Example: a robot picking up objects from a conveyor belt. 4/29/2019 Anand Srinivasan

4 Current Trends Sophisticated real-time applications with high computational demands are emerging. Multiprocessors are becoming extremely cost-effective. Multiprocessor real-time designs will continue to be of growing importance. 4/29/2019 Anand Srinivasan

5 An Example System The Whisper acoustic tracking system at UNC-Chapel Hill. Tracking Computer Microphones on ceiling Speakers on hands and feet User Let me describe one such sophisticated application that we are currently developing at UNC-Chapel Hill. 4/29/2019 Anand Srinivasan

6 Whisper Proposed multi-threaded model
Tasks Microphone Sampler Measurement Kalman filter Microphone Sampler Measurement Microphone Sampler Measurement Real-time fine-grained adaptivity is necessary. A multiprocessor system is required to handle these computationally intensive tasks. 4/29/2019 Anand Srinivasan

7 Periodic Tasks A periodic task consists of an infinite sequence of jobs that are released periodically. 10 20 30 5 15 25 execution requirement period e1 = 2 p1 = 5 4/29/2019 Anand Srinivasan

8 Periodic Tasks Relative deadline of a task is equal to its period. 5
Deadline of a job equals release-time of next job of that task. e1 = 2 p1 = 5 e2 = 9 p2 = 15 5 10 15 20 25 30 Weight of a task with execution requirement e and period p is . 4/29/2019 Anand Srinivasan

9 Real-time Systems Need two algorithms:
(i) Scheduler (typically, run-time). (ii) Schedulability test (typically, offline). Example: Scheduling periodic tasks on a uniprocessor. (i) Scheduler is earliest-deadline-first (EDF). (ii) Schedulability test is “ ”. Yes Run the system with EDF Set of tasks Re-design the system No 4/29/2019 Anand Srinivasan

10 Overview Fair scheduling on multiprocessors Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

11 Overview Fair scheduling on multiprocessors Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

12 Scheduling Problem Given a set of n periodic tasks to be scheduled on m (< n) processors. Determine whether they can be correctly scheduled. Which scheduling approach and algorithm should we use? 4/29/2019 Anand Srinivasan

13 Assumptions Periods and worst-case execution requirements are given.
All values are integral. All processors are identical and main memory is shared. Preemptions and inter-processor migrations are allowed, but parallelism is not. No context switch and migration overhead. These are accounted for in the worst-case execution times of the tasks. 4/29/2019 Anand Srinivasan

14 Feasibility and Optimality
[Baruah et al.] A periodic task set  is feasible on m processors iff weight(T) ≤ m. A scheduling algorithm is said to be optimal if it can correctly schedule any feasible task set. 4/29/2019 Anand Srinivasan

15 Proportionate Fair Scheduling [Baruah et al.]
Scheduling decisions are based on the behavior of an ideal fluid system. TIME A weight = 2/5 2/5 Ideal schedule B 3/5 weight = 3/5 Quantum-based schedule A Pfair schedule is a quantum-based schedule in which tasks are allocated fairly in proportion to their weights. 4/29/2019 Anand Srinivasan

16 Quantum-based schedule
Pfair Scheduling Lag of a task is the difference between its allocations in the ideal and Pfair schedule. TIME Ideal share /5 6/5 9/5 12/ /5 21/5 24/5 27/5 6 B Ideal schedule weight = 3/5 3/5 Actual share Quantum-based schedule lag –2/5 1/5 –1/5 –3/ –2/5 1/5 –1/5 –3/5 0 Definition: A schedule is Pfair if each task’s allocation is strictly within one quantum of the ideal allocation at all times, i.e., –1 < lag < 1. 4/29/2019 Anand Srinivasan

17 Lag of a Periodic Task Lag(T,u) = ideal share of T in [0,u) – Pfair(T,u). lag(T, u) < 0  T is over-allocated at time u. lag(T, u) > 0  T is under-allocated at time u. 6 5 4 3 2 1 ideal Pfair total share of task with weight 3/5. Over-allocated Under-allocated time 4/29/2019 Anand Srinivasan

18 Scheduling of Periodic Tasks
Share of T in ideal schedule in [0,u) = ( )  u. lag(T, u) = – Pfair(T, u). If p divides u, then lag is an integer. –1< lag < 1  lag = 0. Hence, all jobs meet their deadlines. 4/29/2019 Anand Srinivasan

19 Scheduling of Subtasks
Each task is effectively divided into a series of quantum-length subtasks. TIME Subtask 3 Subtask 2 Subtask 1 Consider a task T of weight 3/7. lag = 9/7 lag(T, 3) = (3/7)  3 – 0 = 9/7 > 1 So the first subtask must finish by time 3. 4/29/2019 Anand Srinivasan

20 Scheduling of Subtasks
TIME Subtask 3 Subtask 2 Subtask 1 lag = 8/7 lag(T, 5) = (3/7)  5 – 1 = 8/7 > 1 So the second subtask must finish by time 5. 4/29/2019 Anand Srinivasan

21 Scheduling of Subtasks
TIME Subtask 3 Subtask 2 Subtask 1 lag = –8/7 lag(T, 2) = (3/7)  2 – 2 = –8/7 < –1 So the second subtask cannot be scheduled at time 1. 4/29/2019 Anand Srinivasan

22 Pfair Windows The lag bounds define evenly-spaced windows in which each subtask must execute. TIME Window 3 Window 2 Window 1 Thus, each subtask has a release-time and a deadline. 4/29/2019 Anand Srinivasan

23 Optimal Pfair Schedulers
PF, PD, and PD2. Invoked at the beginning of each quantum. Select m highest-priority subtasks for execution. Use deadlines of subtasks to determine priority. Based on EDF. Differ in the choice of tie-breaking rules. Tie-breaking rules are necessary for optimality on more than three processors. 4/29/2019 Anand Srinivasan

24 The PF Scheduling Algorithm
PF [Baruah et al. 1993] T has higher priority at time t T U t 4/29/2019 Anand Srinivasan

25 PF Swapping Proof Proved optimal by an inductive swapping proof: Transform a correct schedule into a PF schedule. Consider a two-processor schedule. T U 4/29/2019 Anand Srinivasan

26 The PD Scheduling Algorithm [Baruah et al. 1995]
Uses four tie-breaking rules (applied in sequence). Any further ties can be broken arbitrarily. Polynomial time: O (m log n). m processors, n tasks. Proved to be optimal by showing that PD “closely” tracks PF. 4/29/2019 Anand Srinivasan

27 The PD2 Scheduling Algorithm [Anderson and Srinivasan, 2000]
Uses only two tie-breaking rules. Polynomial time: O (m log n). m processors, n tasks. Optimality proved by a swapping proof. Much more complicated than the proof for PF. 4/29/2019 Anand Srinivasan

28 Results about PD2 Most efficient among all known Pfair scheduling algorithms that are optimal. If any of the tie-breaking rules is eliminated, task sets exist that miss deadlines. For systems consisting of tasks with weight at most ½, only one tie-breaking rule is necessary. For two-processor systems, no tie-breaking rules are required. James H. Anderson and Anand Srinivasan, Early-release Fair Scheduling, IEEE Euromicro Conference on Real-time Systems, 2000. 4/29/2019 Anand Srinivasan

29 Overview Fair scheduling on multiprocessors Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

30 Comparison with Partitioning Approaches
Partition the set of tasks so that each task always runs on the same processor. Steps: Choose a uniprocessor scheduling algorithm. Use the corresponding uniprocessor schedulability test to determine the partitions. 4/29/2019 Anand Srinivasan

31 Partitioning Approaches
Disadvantages: Inherently sub-optimal. Consider a two-processor system with three tasks of weight 2/3 (= 0.66) each. Bin-packing is NP-hard in the strong sense. Advantages: Uniprocessor algorithms can be used. No migration overhead is incurred. It performs well in practice. 4/29/2019 Anand Srinivasan

32 Experimental Setup [Srinivasan et al.]
Overheads: Scheduling overheads. Context-switch cost (= 5μs). Cache-related preemption delay ( [0,100μs]). Approach: Generate random periodic task sets with a given total utilization. Calculate new worst-case execution times after incorporating the above overheads. Determine the minimum number of processors required by PD2 and EDF with First-Fit. First-fit: Each task is assigned to the first processor that can accept it. 4/29/2019 Anand Srinivasan

33 System of 50 Tasks 4/29/2019 Anand Srinivasan

34 System of 100 Tasks 4/29/2019 Anand Srinivasan

35 Why use PD2? PD2 gives almost same performance as EDF with First-Fit under all cases. Efficiently supporting critical sections is difficult with partitioning. Efficient schemes have been presented for PD2 by Holman and Anderson [2002, 2003]. Partitioning is not suitable for highly-dynamic task systems. 4/29/2019 Anand Srinivasan

36 Overview Fair scheduling on multiprocessors Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

37 Dynamic Task Systems Whisper re-visited
Features of Whisper: Real-time guarantees are required to ensure high fidelity response. Multiprocessor system is required to handle computational demands. Highly-dynamic system: Fine-grained adaptive nature implies that computational demands vary over time. 4/29/2019 Anand Srinivasan

38 Dynamic Task Systems … …
Unrestricted leaves and joins can lead to missed deadlines Consider a uniprocessor system with one task of weight ½ and k tasks of weight 1/2k. Leaves and immediately rejoins. k-2 2k-1 2k 4/29/2019 Anand Srinivasan

39 Dynamic Task Systems Join condition: Check feasibility with the new task. Leave condition (trickier): Allow task to leave only if it is not over-allocated, i.e., lag  0. This is sufficient on uniprocessors [Stoica et al. 1996] This is not sufficient, in general, on multiprocessors. It is sufficient if the final job executes for its worst-case execution time. We have also provided tighter conditions under which tasks are allowed to leave earlier. Anand Srinivasan and James H. Anderson, Fair scheduling of dynamic task systems on multiprocessors, WPDRTS, 2003. 4/29/2019 Anand Srinivasan

40 Overview Fair scheduling on multiprocessors Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

41 Rate-based Scheduling
Consider the following EDF-scheduled tasks, where each job of task U sends a message. T = (c1, p1) U = (c2, p2) p1 p2 2p1 2p2 3p1 3p2 4p1 5p1 6p1 4p2 messages sent by U These messages are not periodic. So, task consuming these messages is not periodic. It’s even worse if there’s a network in between. 4/29/2019 Anand Srinivasan

42 Intra-sporadic (IS) Tasks
The IS model allows subtasks to be released late, i.e., separation between consecutive subtask releases may be more than that for a periodic task. In addition to release and deadline, each subtask Ti has an eligibility time, which may be less than its release time. 4/29/2019 Anand Srinivasan

43 IS Task Example 1 2 3 4 5 6 7 8 9 10 11 12 13 6 windows of task with weight 3/5. All subtasks are eligible at their Pfair release times. 4/29/2019 Anand Srinivasan

44 IS Task Example 1 2 3 4 5 6 7 8 9 10 11 12 13 IS delay
1 2 3 4 5 6 7 8 9 10 11 12 13 6 windows of task with weight 6/10. 2nd subtask is delayed by one time unit, i.e. the 2nd subtask is eligible only at time 2. The Pfair deadlines also get delayed. 4/29/2019 Anand Srinivasan

45 IS Task Example e < r 1 2 3 4 5 6 7 8 9 10 11 12 13 6 windows of task with weight 6/10. 2nd window is delayed by one time unit. The 3rd subtask is eligible at time 3, and the 2nd subtask is scheduled in slot 2. 4/29/2019 Anand Srinivasan

46 Other Example Applications
Multimedia application: Consider an application receiving packets over a network. Packets arrive in bursts. Possible delay sometimes. Tasks that self-suspend (for example, due to RPC, I/O). Tasks that block (for example, due to locks). 4/29/2019 Anand Srinivasan

47 Results about IS tasks PD2 is optimal on any number of processors. No tie-breaks are necessary on two processors. No tie-breaks are necessary on three processors if all tasks have weight at most ½. Feasibility: An intra-sporadic task system  is feasible on m processors iff weight(T) ≤ m. Anand Srinivasan and James H. Anderson, Optimal Rate-based Scheduling on Multiprocessors, STOC, 2002. 4/29/2019 Anand Srinivasan

48 Optimality of PD2 for IS Tasks Why swapping does not work
U Future windows may not align “properly” for needed swappings to work. 4/29/2019 Anand Srinivasan

49 Overview Fair scheduling Flexibility Summary
Efficiency: The PD2 scheduling algorithm Experimental comparison with other approaches Flexibility Dynamic task systems Rate-based scheduling on multiprocessors Summary 4/29/2019 Anand Srinivasan

50 Summary of Contributions
This talk: The PD2 Pfair scheduling algorithm. Dynamic real-time multiprocessor systems. Rate-based scheduling on multiprocessors. Other work: Soft real-time multiprocessor systems. in submission. Scheduling of packet processing activities on a network processor. Workshop on Network Processors 2003. Scheduling of aperiodic tasks. Euromicro Conference in Real-time Systems 2002. Papers are available at 4/29/2019 Anand Srinivasan

51 Future Vision Highly-dynamic and computation-intensive real-time applications are becoming increasingly common and important. Automatic tracking systems. Telepresence systems. Processing data in disaster recovery and battlefield situations. Long term goal: Design and develop a general framework that can efficiently support such applications. 4/29/2019 Anand Srinivasan

52 Short-term Plans Multiprocessor scheduling issues in general-purpose operating systems. Support for soft real-time applications Quality-of-service (QoS) Guarantees in Networking: Different set of constraints. Intelligent use of spare bandwidth. 4/29/2019 Anand Srinivasan

53 This slide is intentionally left blank!
4/29/2019 Anand Srinivasan

54 Necessity of tie-breaks
Deadline missed! Weight = ¾ 3 Processors, fully utilized: 2 x ¾ + 3 x ½ = 3. Hence, no processor must be idle. Weight = ¾ Weight = ½ Weight = ½ Weight = ½ 4/29/2019 Anand Srinivasan


Download ppt "Anand Srinivasan Department of Computer Science"

Similar presentations


Ads by Google