Expressing Giotto in x Giotto and related schedulability
Expressing Giotto in x. Giotto and related schedulability problems Class Project Presentation Concurrent Models of Computation for Embedded Software University of California, Berkeley, USA Dec 10, 2004 Arkadeb Ghosal Joint work with Christoph M. Kirsch and Thomas A. Henzinger Dec 10, 2003 GSRC Review Meeting
Overview q q Introduction x. Giotto Language Features q q q The LET model Basic Constructs Event Scoping Event Handling Giotto-to-x. Giotto Translation Observations and Present Status 10 Dec Project Presentation 2
Introduction q Languages based on Logical Execution Time (LET) for tasks q q q Giotto q q q Time Triggered Periodic invocation of tasks A mode describes a set of periodic tasks Mode switch defines conditions to jump from one mode to another Timed Multitasking q q q A termination event is specified on release of a task The evaluation of a task is available only after the termination event Event triggered Assigns deadline for a task at the time of release x. Giotto q q 10 Dec Event Triggered Scoping of events Project Presentation 3
Logical Execution Time The logical and physical execution times are depicted below. The events controlling a task behavior are: Events from logical side: • release • termination release event Logical Physical 10 Dec { { Events from physical side: • start • preempt • resume • completion Logical Execution Time (LET) termination event active running release start preemption resume Project Presentation running completion termination 4
x. Giotto: Basic Constructs q Reaction Blocks q q q Basic programming blocks in x. Giotto Consists of release statements and trigger statements along with an termination information Releases tasks and invokes triggers q q Release Statements q q Tasks are released with the invocation of the reaction block Tasks are terminated with the termination of the reaction block q q q release task (input ports) (output ports); LET of the task is given by the life-span of the reaction block Trigger Statements q Associates an event with a reaction block q q react {reaction block} until [event]; The reaction block is invoked when the event occurs when [event] reaction block; Repetition construct using whenever Event Scopes q q A reaction block defines a scope for its events When a reaction block is invoked (a trigger is activated) q q 10 Dec The events of the new reaction block are enabled (active) The events of the callee reaction block become passive (inactive) Project Presentation 5
Basic Features (cont. ) Reaction Block Reaction Name Events of R 1: e 2, e 3, e 7 react R 1 { when [e 2] react R 2; when [e 3] react R 3; } until [e 7]; Triggers Termination Event Scope of e 2, e 3, e 7: R 1 Task Name Release Statement 10 Dec react R 1 { release t 1 (i 1) (o 1); when [e 2] react R 2; when [e 3] react R 3; } until [e 7]; Project Presentation Input Port Output Port 6
Reactions and Triggers react R 1 { when [e 2] react R 2; when [e 3] react R 3; } until [e 7]; react R 3 { when [e 4] react R 4; } until [e 6]; e 2 e 3 e 2, e 3, e 7 10 Dec e 4, e 6 e 2, e 7 react R 4 { } until [e 5]; react R 2 { when [e 8] react R 5; } until [e 9]; e 6 e 4 e 5 e 6 e 2, e 7 Project Presentation e 6 e 2, e 7 e 8, e 9 e 7 7
Tasks are released with the invocation of the reaction block Tasks are terminated with the termination of the reaction block q q react R 1 { when [e 2] react R 2; when [e 3] react R 3; } until [e 7]; react R 3 { release t 1; when [e 4] react R 4; } until [e 6]; e 2 e 3 e 2, e 3, e 7 10 Dec react R 2 { react R 4 { release t 2; release t 3; when [e 8] react R 5; } until [e 5]; } until [e 9]; e 6 e 4, e 6 e 4 e 5 e 6 e 2, e 7 t 1, t 2 t 1 Project Presentation e 6 e 2, e 7 e 8, e 9 e 7 t 3 8
Handling Events A reaction block defines a scope: this implicitly denotes the scope of an event When an active trigger is invoked, the called reaction becomes the active scope and the caller reaction, the passive scope The event of a passive scope can be q q q Ignored (forget) Postponed until its scope becomes active again (remember) react R 1 { when [e 2] react R 2; when [e 3] react R 3; } until [e 7]; react R 3 { when [e 4] react R 4; } until remember [e 6]; react R 4 { } until [e 5]; react R 2 { when [e 8] react R 5; } until [e 9]; e 2 e 3 e 2, e 3, e 7 10 Dec e 4, e 6 e 2, e 7 e 4 e 5 e 6 e 2, e 7 e 6 e 5 e 6 e 2, e 7 Project Presentation e 5 e 2, e 7 e 8, e 9 e 7 9
Parallelism q q q A trigger may invoke multiple reaction blocks in parallel. When the trigger is invoked all the reactions become active simultaneously. The parent block is active only when all the parallel reaction blocks have terminated. e 6, e 8 e 5, e 9 e 6 e 8 e 5, e 9 10 Dec e 8 e 4 e 4 t 1, t 2 e 7 e 7 e 2 react R 6 { } until [e 4]; e 8 e 7 e 2, e 7 react R 2 { release t 2; when [e 6] react R 6; } until [e 8]; react R 3 { release t 1; when [e 5] react R 5; } until [e 9]; react R 1 { when [e 2] react R 2 || R 3; } until [e 7]; t 1, t 2 Project Presentation t 2 10
The Program Flow Event Filter: The Event Filter implements the event scoping mechanism and filter the incoming event. It determines which event needs to be reacted upon depending upon the event qualifiers – forget, remember or asap. Reaction Event Filter e 2 10 Dec e 3 e 5 R 1: call driver schedule task 1 R 2: call driver when(ever) A exit schedule task 1 by X when(ever) Y until A exit Activate Event (when/whenever) (until) Scheduler: The Scheduler chooses from the active tasks, a task to be executed on the given platform (CPU). Schedule Terminate Reactive Machine e 1 e 4 Reactor: The Reactor executes the specified reaction and activates new events (when/whenever/until) and activates and terminates tasks. Project Presentation Scheduler task 1 task 2 task 3 task 4 task n 11
Program Analysis q Platform independent q Race Condition Detection q q Resource Size Analysis q q Predicting the run-time memory requirements for executing an x. Giotto program: the bound on the size of the event filter and scopes (trigger queue size and active task set size). Platform dependant q Schedulability Analysis q 10 Dec Verifying whether a port may be updated by multiple task invocations and thus leading to non-determinism Ensuring that all the task invocations get access to the executing platform at least equal to their worst-case-execution times before their termination Project Presentation 12
Motivation q Simple Schedulability check for Giotto q q Type system q q q Time-triggered Expressing Giotto Syntactic characteristics of such a sub-class Scheduling the sub-class Extending to event-triggered systems q 10 Dec Typed E-code has simple schedulability check Giotto compiler generates typed E-code Interesting Sub-class of x. Giotto q q If all modes are reachable, check is polynomial and is necessary If some modes are unreachable the check is sufficient Reachability of modes is pspace-complete Schedulability check is not possible for arbitrary event Project Presentation 13
Giotto-to-x. Giotto (mode) 0 1 2 3 4 5 6 m_0 m_1 m_2 mode m period 6 task t 1 period 3 task t 2 period 2 m_3 m_4 m_5 10 Dec Project Presentation 14
Giotto-to-x. Giotto (mode switch) 0 1 2 3 4 5 6 m 1_0 mode m 1 period 6 task t 1 period 3 task t 2 period 2 switch frequency 3 m 1_1 m 1_2 mode m 2 period 6 task t 1 period 3 task t 3 period 2 switch frequency 3 m 1_4 m 2_4 m 1_5 m 2_5 10 Dec Project Presentation 15
Giotto-to-x. Giotto (? ) mode m 1 period 6 task t 2 period 3 switch frequency 2 mode m 2 period 12 task t 1 period 6 task t 3 period 4 switch frequency 3 Termination Events are finite No cyclic calls All Giotto programs cannot be expressed in x. Giotto in its present form Giotto programs with all modes releasing a task of frequency one and/ or releasing a a set of harmonic tasks can be expressed 10 Dec Project Presentation 16
Proposed modifications q No parallel construct q q Out-of-scope activation q q All triggers with same event will be enabled simultaneously Trigger events with immediate form Modification of until event q Extending to termination event and continuation event q q q Tasks terminate by termination event Parallel reaction blocks can be released at continuation event Constraints on parallelism react M 12 until 3 continue 2; react M 2 until 2 continue 1; react M 1 until 3 continue 1; react M 2 until 2 continue 2; 10 Dec Project Presentation 17
Proposed Modifications (cont. ) /* main */ if (mode = m 1) react m 1; if (mode = m 2) react m 2; react m 1_0 until 6 continue 3; if (sw 12) { react {} until 1; react m 2_5 until 2; } else react m 1_1 until 3; 10 Dec react m 1_0 until 6 continue 4; if (sw 21) { react {} until 2; } else { react m 1_2 until 4 continue 2; react m 1_3 until 6 continue 2; if (sw 21) { react {} until 1; if (sw 12) { react {} until 1; react m 2_5 until 2; } else react m 1_1 until 3; } else { react m 1_4 until 4; } Project Presentation 18
Schedulability q Sub-class under study q q q Composability q q Time triggered, all events remembered, all children terminates before their parent (span of a node is never extended) Sub-class that can express Giotto Two parallel reaction blocks should be schedulable independent of each other Reaction Dependency Graph q A Graph denoting the calling pattern of the reaction blocks q q 10 Dec For time-triggered programs the exact pattern can be derived An efficient way to describe the size of the program Project Presentation 19
Schedulability (cont. ) q Horn’s algorithm q q Given a set of aperiodic tasks with their release time, termination time and worst-case-execution-time determines the schedulability Provides an EDF based scheduling strategy q q Efficient pruning of conditional branches q q 10 Dec EDF is optimal for such a task pattern Utilization test Syntactic constraints t 1 t 2 t 3 t 4 t 5 Release Time 0 2 2 4 5 Termination Time 4 15 6 7 10 Worst-case Execution-time 2 3 1 2 3 Project Presentation 20
Thank You ! 10 Dec Project Presentation 21
- Slides: 21