Critique #4 Ø Due next Tuesday (4/14) Ø Y. Zhang, C. Lu, C. Gill, P. Lardieri and G. Thaker, Middleware Support for Aperiodic Tasks in Distributed Real-Time Systems, IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS), April 2007. Chenyang Lu 1
Real-Time Scheduling Multiprocessor and Distributed Systems Chenyang Lu
Multiprocessor System Ø Tight coupling among processors. Ø Communicate through shared memory and on-board bus. Ø Scheduled by a common scheduler/OS. q Global scheduling q Partitioned scheduling Ø States of all processors available to each other. Chenyang Lu 3
Distributed System Ø Loose coupling among processors q Each processor has its own scheduler q Costly to acquire states of other processors Ø Wide range of systems q Processor boards mounted on a VME bus q Automobile: 100s processors connected through Control Area Networks (CANs) q Air traffic control system on a wide area network Chenyang Lu 4
End-to-End Task Model Ø An (end-to-end) task is composed of multiple subtasks running on multiple processors q Message, event, remote method invocation Ø Task = a chain/tree/graph of subtasks q T i = {T i,1 , T i,2 ,… , T i,n(i) } q n(i): the number of subtasks of T i q Precedence constraint: Job J i,j cannot be released until J i,j-1 finishes. T 1 T 11 T 12 T 13 Precedence Constraints T 3 Subtask T 2 P 2 P 3 P 1 Chenyang Lu 5
An End-to-End Task on Event Service Ø Dependency implemented through events Ø Event Channel (EC) dispatches events according to their priorities. Ø Gateway forwards events between processors. EC EC EC Gateway Gateway T 1,3 T 1,1 T 1,2 Application Application Application Processor 1 Processor 2 Processor 3 Chenyang Lu 6
End-to-End Deadline Ø A task is subject to an end-to-end deadline. Ø Does not care about the response time of a subtask. Ø How to guarantee end-to-end deadlines in distributed systems? Chenyang Lu 7
End-to-End Scheduling 1. Task allocation 2. Synchronization protocol 3. Subdeadline assignment 4. Schedulability analysis Chenyang Lu 8
Task Allocation Ø Map tasks to processors Ø Strategies q Offline à static allocation q Online • Allocate a task when it arrives • Re-allocate (migrate) a task after it starts Ø NP-hard à heuristics needed Chenyang Lu 9
Bin Packing Ø Pack subtasks to bins (processors) with limited capacity q Size of a subtask T i,j : u i,j = C i,j /P i q Capacity of each bin: utilization bound Ø Goal: minimize #bins subject to capacity constraints q Ignore communication cost q Assume every subtask is periodic Chenyang Lu 10
Bin Packing: First-Fit Ø Subtasks assigned in arbitrary order Ø To allocate a new subtask T i,j q if T i,j can be added to an existing processor S m (1 £ m £ k) without exceeding its capacity • allocate T i,j à S m q else • add a new processor S k+1 and allocate T i,j à S k+1 . Chenyang Lu 11
First-Fit Performance Ø #Processor needed: m/m min à 1.7 as m min à ∞ q m: #processor needed under First-Fit q m 0 : minimum #processor needed Ø First-Fit can always find a feasible allocation on m processors if total subtask utilization ≤ m(2 1/2 -1) = 0.414m q Assuming identical processors Chenyang Lu 12
Minimize Communication Cost Ø Inter-subtask communication introduces overhead & delay Ø Minimize communication subject to processor capacity constraints q Partition subtasks into groups q Allocate groups to processors Chenyang Lu 13
End-to-End Scheduling 1. Task allocation 2. Synchronization protocol 3. Subdeadline assignment 4. Schedulability analysis Chenyang Lu 14
Synchronization Requirements Ø Allow schedulability analysis Ø Bounded worst-case response time Ø Low overhead Ø Low jitter Ø Low average response time Chenyang Lu 15
Greedy Protocol Ø Release job J i,j;k as soon as J i,j-1;k is completed Ø Subtasks may not be periodic under a greedy protocol q Difficult to analyze schedulability q High-priority tasks arrive early à long worst-case response time for low-priority tasks q Jitter can accumulate over multiple hops Chenyang Lu 16
Greedy Protocol Example T 1 T 2,2 (4,2) (6,2) P1 P2 T 2,1 T 3 (6,2) (6,3) T 1 2 4 6 8 10 12 T 2,1 2 4 6 8 10 12 On P1 On P2 T 2,2 T 3 2 4 6 8 10 12 misses deadline Phase of T 3 T 3 2 4 6 8 10 12 Chenyang Lu 17
Critique of Greedy Protocol Ø Low overhead Ø Low average response time Ø High jitter Ø Difficult to analyze schedulability Ø Long worst-case response time Chenyang Lu 18
Phase-Modification Protocol (PMP) • Enforce periodic release based on the worst-case response times of preceding subtasks. • Every job J i,j;k is released at time + å - j 1 f + - ( k 1) P R i i i l , = l 1 – R i,l : worst case response time of T il • Require upper bounds on the response times of all subtasks. • Modified PMP (MPMP): Same as PMP and a subtask cannot be released unless its predecessor has been completed. Chenyang Lu 19
MPMP Illustrated T 1 T 2,2 (4,2) (6,2) P1 P2 T 2,1 T 3 (6,2) (6,3) T 1 2 4 6 8 10 12 Synch signal delayed T 2,1 2 4 6 8 10 12 On P1 On P2 T 2,2 2 4 6 8 10 12 Phase of T 3 T 3 2 4 6 8 10 12 Chenyang Lu 20
Properties of MPMP Ø Enable schedulability analysis Ø Bounded worst-case response time Ø Low jitter Ø Does not require global clock synchronization q Indicate “ahead time” in sync message Ø Require worst-case response times of all subtasks Ø Long average response time Chenyang Lu 21
Release Guard if CPU never idles since releasing J i,j;k, release J i,j;k+1 when q it receives a sync message from J i,j;k , or q at time r i,j;k-1 +P i whichever is later // periodic release based on local knowledge else, release J i,j;k+1 when q receiving a sync message from J i,j;k , or q when processor becomes idle // improve response time whichever is later Improve average response time without affecting schedulability Chenyang Lu 22
Release Guard Illustrated T 1 T 2,2 (4,2) (6,2) P1 P2 T 2,1 T 3 (6,2) (6,3) T 1 2 4 6 8 10 12 T 2,1 2 4 6 8 10 12 On P1 On P2 g 2,2 = 0 g 2,2 = 4+6=10 g 2,2 = 9 g 2,2 = 9+6=15 T 2,2 2 4 6 8 10 12 Idle time Phase of T 3 detected T 3 2 4 6 8 10 12 Chenyang Lu 23
Non-Assumptions ü Do not require worst-case response times of all subtasks ü Do not require global clock synchronization ü Work best for loosely coupled system! Chenyang Lu 24
Properties of Release Guard Ø Enable schedulability analysis Ø Bounded worst-case response time Ø Does not require global clock synchronization Ø Low jitter (if idle rule is not used) Ø Low average response time (if idle rule is used) Chenyang Lu 25
RG: Middleware Implementation If current time is earlier than the release guard T g Ø EC I/O thread buffers the event in the release guard queue; Ø At T g , RG thread removes the buffered event from queue and inserts it into a dispatching lane EC I/O Dispatching Thread Thread Y. Zhang, B. Thrall, S. Torri, C. Gill, C. Lu, A Real-Time Performance Comparison of Distributable Threads and Event Channels, RTAS'05. RG Thread Chenyang Lu 26
Score Board: Sync Protocols Schedulability WCRT ART Global State Jitter Greedy Hard H L N H MPMP Y L H Y L RG Y L M/H N M/L • if information about all tasks are available a priori • use RG or MPMP • else • use RG Chenyang Lu 27
End-to-End Scheduling 1. Task allocation 2. Synchronization protocol 3. Subdeadline assignment 4. Schedulability analysis Chenyang Lu 28
Subdeadline Assignment Ø Subdeadline à priority à response time Ø Optimal subdeadline assignment is NP-hard q Offline: heuristic search q Online: simpler heuristics Chenyang Lu 29
Subdeadline Assignment Ø Notations q Relative deadline D i of task T i q Relative subdeadline D ij of subtask T ij (1 £ j £ n(i)) Ø Ultimate Deadline (UD): D ij = D i q But some subtasks must finish earlier than the end-to-end deadline! Chenyang Lu 30
More Heuristics • Proportional Deadline (PD): C ij = D D å ij i n i ( ) C ik = k 1 – Assign slack proportionally to execution time • Normalized Proportional Deadline C U V ( ) ij i j , = D D å ij i n i ( ) ( C U V ( )) ik i k , = k 1 – Assign more slack to subtasks on busier processors Chenyang Lu 31
End-to-End Scheduling 1. Task allocation 2. Synchronization protocol 3. Subdeadline assignment 4. Schedulability analysis Chenyang Lu 32
Recommend
More recommend