240 likes | 362 Views
Scheduling of Distributed Real-Time Systems. Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building 321 DK2800 Lyngby, Denmark Jan@imm.dtu.dk. 1. 3. 2. 1. 2. 4. 3. 4. os. os. scheduling. a. b. mem. a. b. mem.
E N D
Scheduling of Distributed Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building 321 DK2800 Lyngby, Denmark Jan@imm.dtu.dk
1 3 2 1 2 4 3 4 os os scheduling a b mem a b mem Multi-processor scheduling (c) Jan Madsen
Characteristics to be handled • Processes: • preemptive and non-preemptive • periodic and aperidoic • processes with multiple levels of importance • group of processes with single deadline • Constraints and requirements: • end-to-end timing • precedence relations • communication • shared resources • placement • hard and soft deadlines • fault tolerance (c) Jan Madsen
Handling interfaces between • CPU scheduling and resource allocation • IO scheduling and CPU scheduling • CPU scheduling and communication scheduling • Local and distributed scheduling • Static scheduling of critical processes and dynamic scheduling of other processes Comprehensive results willnotexist for many years! (c) Jan Madsen
Phases of real-time distributed systems scheduling • Allocation • assigning processes and resources to processors in the system • Scheduling • Ordering the execution of processes and communications to meet timing and resource constraints • Dispatching • Executing the processes in conformance with the scheduler’s decisions (c) Jan Madsen
Approaches to embedded system scheduling • deterministic (static) scheduling • Allocating and static scheduling all periodic processes off-line • Allocate time-slots for handling non-periodic processes • Distributed scheduling • Each CPU runs its own scheduler • Set of processes is distributed, statically allocated but dynamically activated (c) Jan Madsen
Static distributed scheduling • Typical approach • Construct a comprehensive graph containing all process instances that executes in an interval of length T (T is the least common multiple of all process periods) • Cluster communicating processes • Allocate clusters of processes to PEs and schedule processes and communications (c) Jan Madsen
Specification Architecture PE1 PE2 t1 t2 t3 bus Characterization Scheduling PE1 PE2 PE1 t1 t2 t3 PE2 A Simple Example (c) Jan Madsen
PE1 PE2 t1 t2 t3 bus 5 - 20 10 20 15 15 First solution Specification Architecture Characterization Scheduling PE1 PE2 PE1 t1 t2 t1 t2 t3 PE2 t3 (c) Jan Madsen
t1 50 10 5 t2 t3 t2 5 - 10 20 25 15 15 t3 Introducing communication Specification Architecture Can transfer 2 data units per time unit PE1 PE2 bus Characterization Scheduling PE1 PE2 PE1 t1 t1 bus t2 t3 PE2 (c) Jan Madsen
t1 50 10 i1 i2 t2 t3 5 - 10 20 27 15 15 Introducing interfaces Specification Architecture PE1 PE2 Can buffer 10 data units per time unit bus Characterization Scheduling PE1 PE2 PE1 t1 t2 i1 t1 bus t2 i2 t3 PE2 t3 (c) Jan Madsen
PE PE t1 Memory size time Memory? Memory contributions: program t1 data data to be transferred Memory utilization: (c) Jan Madsen
Peak memory 510,2 - 105,5 2010,5 155,5 1510,5 Introducing memory Specification Architecture PE1 PE2 t1 50 10 i1 i2 t2 t3 bus Characterization Scheduling PE1 PE2 PE1 t1 t2 10 = 77 t1 50 t2 2 t3 5 10 (c) Jan Madsen
Dynamic multi-processor scheduling • Primary objective is to ensure that all timing constraints are met • Serious difficulties in validating hard timing constraints • Assumptions: • Each processor has its own scheduler • The scheduler uses a uni-processor scheduling algorithm • Schedulers on different processors need not use the same algorithm (c) Jan Madsen
Multi-processor scheduling • Task assignment • Most real-time systems are static, tasks are partitioned and statically bound to processors • Inter-processor synchronization • Ensuring that precedence constraints of tasks on different processors are always satisfied (c) Jan Madsen
3 1 4 2 Task assignment • Often done off-line • NP-hard problem • Assignment based on: • Execution times • Resource requirements • Data dependencies • Timing constraints • Communication cost • ... os os a b (c) Jan Madsen
Rate-Monotonic First-Fit algorithm: • Sort tasks in increasing order according to their period • Assign tasks one by one • is assigned to • is assigned to if the total utilization of and the tasks already assigned to < URM 2 1 1 2 3 3 4 i i k a k A synchronization signal makes sure that is released as soon as has completed Task assignment - RMFF • Example: Assume zero communication overhead Scheduling based on fixed priorities (c) Jan Madsen
4 2 2 1 2 3 1 1 4 3 3 4 os os a b Example (c) Jan Madsen
2 4 RM RM 1 1 3 a 2 0 2 4 6 8 10 12 14 16 3 b 4 0 2 4 6 8 10 12 14 16 Dynamic scheduling os os a b (c) Jan Madsen
2 4 3 1 Changing synchronization protocol RM EDF 1 a 2 os os a b 0 2 4 6 8 10 12 14 16 3 b 4 0 2 4 6 8 10 12 14 16 (c) Jan Madsen
Multi-processing anomalies • Assume a set of tasks optimally scheduled on a multiprocessor system with: • fixed number of processors • fixed execution times (ei) • precedence constraints • Then • changingthe priority list • increasingthe number of processor • reducing execution times • weakening the precedence constraints • May increase the scheduling length! (c) Jan Madsen
2 1 2 1 3 5 4 3 4 5 1 2 a a b b 3 4 5 Example of anomalies Task 2 and 4 are sharing a resource, i.e. mutually exclusion Reduce e1 of task 1 (c) Jan Madsen
Consequences of anomalies • Tasks may complete before their WCETs • So most on-line scheduling algorithms are subject to experience anomalies • Simple but inefficient solution: • Have tasks completing early idle (c) Jan Madsen
Summary • Introduction to classical uni-processor multi-task scheduling • illustration of multi-processor scheduling • Not covered: • Priority inversion when having shared resources • Context switching and cache overhead • Overload conditions • Low power scheduling, • Increasing idle periods on processors • Voltage scaling • Communication (c) Jan Madsen