210 likes | 215 Views
Explore xGiotto language features, LET model, event scoping, and translations. Delve into task scheduling problems and related studies.
E N D
Expressing Giotto in xGiotto 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
Overview • Introduction • xGiotto Language Features • The LET model • Basic Constructs • Event Scoping • Event Handling • Giotto-to-xGiotto Translation • Observations and Present Status Project Presentation
Introduction • Languages based on Logical Execution Time (LET) for tasks • A termination event is specified on release of a task • The evaluation of a task is available only after the termination event • Giotto • 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 • Event triggered • Assigns deadline for a task at the time of release • xGiotto • Event Triggered • Scoping of events Project Presentation
release event Logical Execution Time (LET) termination event { Logical active { running running Physical release start preemption resume completion termination Logical Execution Time • Events from physical side: • start • preempt • resume • completion The logical and physical execution times are depicted below. The events controlling a task behavior are: • Events from logical side: • release • termination Project Presentation
xGiotto: Basic Constructs • Reaction Blocks • Basic programming blocks in xGiotto • Consists of release statements and trigger statements along with an termination information • Releases tasks and invokes triggers • react {reaction block} until [event]; • Release Statements • Tasks are released with the invocation of the reaction block • Tasks are terminated with the termination of the reaction block • release task (input ports) (output ports); • LET of the task is given by the life-span of the reaction block • Trigger Statements • Associates an event with a reaction block • The reaction block is invoked when the event occurs • when [event] reaction block; • Repetition construct using whenever • Event Scopes • A reaction block defines a scope for its events • When a reaction block is invoked (a trigger is activated) • The events of the new reaction block are enabled (active) • The events of the callee reaction block become passive (inactive) Project Presentation
react R1 { when [e2] react R2; when [e3] react R3; } until [e7]; Reaction Block Triggers Reaction Name Termination Event Scope of e2, e3, e7: R1 Events of R1: e2, e3, e7 Task Name Input Port react R1 { release t1 (i1) (o1); when [e2] react R2; when [e3] react R3; } until [e7]; Release Statement Output Port Basic Features (cont.) Project Presentation
e2 e3 e5 e6 e4 Reactions and Triggers react R1 { when [e2] react R2; when [e3] react R3; } until [e7]; react R2 { when [e8] react R5; } until [e9]; react R3 { when [e4] react R4; } until [e6]; react R4 { } until [e5]; e2 e6 e5 e4,e6 e8,e9 e6 e6 e2,e7 e2,e3,e7 e2,e7 e7 e2,e7 e2,e7 Project Presentation
e2 e6 e3 e4 e5 Tasks • Tasks are released with the invocation of the reaction block • Tasks are terminated with the termination of the reaction block react R1 { when [e2] react R2; when [e3] react R3; } until [e7]; react R3 { release t1; when [e4] react R4; } until [e6]; react R2 { release t3; when [e8] react R5; } until [e9]; react R4 { release t2; } until [e5]; e2 e6 e5 e4,e6 e8,e9 e6 e6 e2,e7 e2,e3,e7 e2,e7 e7 e2,e7 e2,e7 t3 t1 t1, t2 t1 Project Presentation
e2 e6 e3 e5 e4 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 • Ignored (forget) • Postponed until its scope becomes active again (remember) react R1 { when [e2] react R2; when [e3] react R3; } until [e7]; react R3 { when [e4] react R4; } untilremember [e6]; react R2 { when [e8] react R5; } until [e9]; react R4 { } until [e5]; e2 e5 e5 e4,e6 e8,e9 e6 e6 e2,e7 e2,e3,e7 e2,e7 e7 e2,e7 e2,e7 Project Presentation
e2 e4 e9 e6 Parallelism • 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. react R2 { release t2; when [e6] react R6; } until [e8]; react R3 { release t1; when [e5] react R5; } until [e9]; react R1 { when [e2] react R2 || R3; } until [e7]; react R6 { } until [e4]; e8 e7 e7 e7 e7 e2,e7 e7 e8 e8 e8 e5,e9 e6,e8 e5,e9 e4 e4 t2 t2 t1, t2 t1, t2 Project Presentation
Reaction Schedule Terminate Event Event Filter Reactive Machine Scheduler e1 R1: call driver schedule task1 when(ever) A exit task1 task2 R2: call driver schedule task1 by X when(ever) Y until A exit task3 e2 e3 task4 task n e4 e5 Activate Event (when/whenever) (until) 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 . Reactor: The Reactor executes the specified reaction and activates new events (when/whenever/until) and activates and terminates tasks. Scheduler: The Scheduler chooses from the active tasks, a task to be executed on the given platform (CPU). Project Presentation
Program Analysis • Platform independent • Race Condition Detection • Verifying whether a port may be updated by multiple task invocations and thus leading to non-determinism • Resource Size Analysis • Predicting the run-time memory requirements for executing an xGiotto program: the bound on the size of the event filter and scopes (trigger queue size and active task set size). • Platform dependant • Schedulability Analysis • 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
Motivation • Simple Schedulability check for Giotto • 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 • Type system • Typed E-code has simple schedulability check • Giotto compiler generates typed E-code • Interesting Sub-class of xGiotto • Time-triggered • Expressing Giotto • Syntactic characteristics of such a sub-class • Scheduling the sub-class • Extending to event-triggered systems • Schedulability check is not possible for arbitrary event Project Presentation
0 1 2 3 4 5 6 m_0 m_1 m_2 m_3 m_4 m_5 Giotto-to-xGiotto (mode) mode m period 6 task t1 period 3 task t2 period 2 Project Presentation
0 1 2 3 4 5 6 m1_0 mode m1 period 6 task t1 period 3 task t2 period 2 switch frequency 3 m1_1 m1_2 mode m2 period 6 task t1 period 3 task t3 period 2 switch frequency 3 m1_3 m1_4 m2_4 m1_5 m2_5 Giotto-to-xGiotto (mode switch) Project Presentation
mode m1 period 6 task t1 period 6 task t2 period 3 switch frequency 2 mode m2 period 12 task t1 period 6 task t3 period 4 switch frequency 3 Giotto-to-xGiotto (?) Termination Events are finite No cyclic calls All Giotto programs cannot be expressed in xGiotto 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 Project Presentation
Proposed modifications • No parallel construct • All triggers with same event will be enabled simultaneously • Out-of-scope activation • Trigger events with immediate form • Modification of until event • Extending to termination event and continuation event • Tasks terminate by termination event • Parallel reaction blocks can be released at continuation event • Constraints on parallelism react M12 until 3 continue 2; react M2 until 2 continue 1; react M1 until 3 continue 1; react M2 until 2 continue 2; Project Presentation
Proposed Modifications (cont.) react m1_0 until 6 continue 4; if (sw21) { react {} until 2; } else { react m1_2 until 4 continue 2; react m1_3 until 6 continue 2; if (sw21) { react {} until 1; if (sw12) { react {} until 1; react m2_5 until 2; } else react m1_1 until 3; } else { react m1_4 until 4; } /* main */ if (mode = m1) react m1; if (mode = m2) react m2; react m1_0 until 6 continue 3; if (sw12) { react {} until 1; react m2_5 until 2; } else react m1_1 until 3; Project Presentation
Schedulability • Sub-class under study • Time triggered, all events remembered, all children terminates before their parent (span of a node is never extended) • Sub-class that can express Giotto • Composability • Two parallel reaction blocks should be schedulable independent of each other • Reaction Dependency Graph • A Graph denoting the calling pattern of the reaction blocks • For time-triggered programs the exact pattern can be derived • An efficient way to describe the size of the program Project Presentation
Schedulability (cont.) • Horn’s algorithm • 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 • EDF is optimal for such a task pattern • Efficient pruning of conditional branches • Utilization test • Syntactic constraints Project Presentation
Thank You ! Project Presentation