Abstract 1 Introduction 2 System Model 3 Time-Triggered Model Extensions 4 Timed Mode-Change Extensions 5 Mixed-Criticality Execution Example 6 Performance evaluation 7 Related Work 8 Conclusion References Appendix A Ada Framework Type definitions Appendix B Complete Framework API Appendix C Ada Code for the Example Scheduling Plan

A Flexible Ada Framework for Jitter-Sensitive Mixed-Criticality Real-Time Systems

Sergio Sáez Barona ORCID Instituto Universitario Mixto Tecnológico de Informática, Universitat Politècnica de València, Spain    Jorge Real Sáez ORCID Instituto de Automática e Informática Industrial, Universitat Politècnica de València, Spain
Abstract

Real-time systems often require combining time-triggered (TT) and event-triggered (ET) execution models to balance predictability and flexibility. Previous work proposed a unified framework supporting both paradigms, enabling the integration of jitter-sensitive activities within a static TT schedule while preserving the responsiveness of ET execution. However, that framework did not address the requirements of mixed-criticality systems (MCS), where tasks may exhibit different execution-time assumptions depending on the system criticality level.

This paper extends the original framework, designed for Ada under the Ravenscar profile, to support mixed-criticality workloads. First, the task model is enhanced to incorporate multiple execution-time estimates per job, allowing tasks to adapt their behaviour across criticality levels, including the possibility of selectively disabling jobs. Second, the TT scheduling model is extended to support criticality-aware execution, introducing adaptive slot durations, application-level overrun handling, and mechanisms to control the system criticality level at run time. Third, the framework preserves the semantic consistency of multi-frame tasks under criticality-level changes by defining a clear separation between system-wide and task-local criticality.

Additionally, the mode-change mechanism is extended to support timed mode changes, enabling precise control over plan transitions and facilitating synchronisation across distributed schedules.

The proposed approach maintains the predictability of TT execution while providing the flexibility required to support mixed-criticality behaviour. An execution example illustrates the applicability of the framework and the interaction between its main components.

Keywords and phrases:
Real-time systems, Time-triggered scheduling, Mixed-criticality systems, Ravenscar tasking profile, High-integrity systems, Embedded systems
Copyright and License:
[Uncaptioned image] © Sergio Sáez Barona and Jorge Real Sáez; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Computer systems organization Real-time operating systems
; Computer systems organization Embedded software
Supplementary Material:
​Software  (Source Code): https://doi.org/10.5281/zenodo.19636270 [14]
Editors:
Antonio Filieri and Peter Backeman

1 Introduction

Real-time computing systems can be characterized as set of concurrent activities, commonly referred to as tasks, that must be executed over time while satisfying specific temporal constraints. These constraints may include requirements such as periodic activation rates or deadlines by which tasks must complete their execution. In order to guarantee that these temporal requirements are met, the scheduling strategy must be predictable and analysable, allowing system designers to verify beforehand that all timing constraints will be satisfied when the system was deployed.

Two main paradigms are commonly employed in the design and scheduling of real-time systems: time-triggered and event-triggered approaches. In time-triggered (TT) systems, task execution is governed by a statically defined schedule that is constructed offline. This schedule specifies precisely when each task starts executing and how long it is allowed to run. In contrast, event-triggered (ET) systems rely on the occurrence of events to activate tasks. The timing of such events may not be known in advance. Some events are periodic in nature, such as the expiration of timer intervals, whereas others may occur asynchronously, for instance when a particular system condition is reached or when an external event is received. During execution, the scheduler dynamically decides which task should run next, typically based on the priorities assigned to the tasks whose activation events have occurred.

Both design paradigms present distinct advantages and limitations, and neither can be considered universally superior. Time-triggered systems provide lower run-time overheads and strong guarantees in terms of runtime predictability since the schedule is fully determined beforehand, which effectively ensures schedulability by construction. However, this approach often leads to increased design complexity and reduced flexibility. In some cases, timing considerations must even be reflected directly in the functional implementation of tasks. For example, when a task’s worstcase execution time exceeds the duration of a schedule slot, its code may need to be partitioned across multiple slots. Although TT systems can handle asynchronous events, doing so usually requires mechanisms such as periodic sampling or more elaborate techniques to reduce reaction latency.

Event-triggered systems, on the other hand, facilitate a clearer separation between functional behaviour and timing management. For instance, a preemptive scheduler can interrupt and resume tasks according to their priorities, allowing long computations to be naturally divided during execution. ET systems also support non-periodic activities in a more direct way. Nevertheless, their dynamic nature introduces uncertainty in timing behaviour and requires dedicated schedulability analysis methods to ensure correctness. In particular, tasks may experience variable release delays due to interference from higher-priority tasks. Such variability can be problematic in certain applications. For example, in digital control systems it may degrade the performance of control algorithms, and in distributed systems it can negatively affect synchronous communication among components.

In previous publications [11, 12], we proposed a framework for the combined execution of time- and event-triggered tasks (TT and ET tasks, respectively). In this framework, TT tasks are released by a time-driven scheduler according to an offline-designed scheduling table, or plan, whereas ET tasks are handled by an underlying priority-based scheduler. The framework was specifically designed for implementation in Ada under the Ravenscar profile [4, 6], and was realised as a Ravenscar-compliant runtime in [10], relying on the fixed-priority preemptive scheduler provided by a modified version of the Ada Run-Time System for the target STM32F4 MCU.

In this framework, TT schedules can be executed at a selectable priority level of the priority scheduler. It can be for example the highest, thus forming a hierarchy where TT tasks take precedence over the rest and hence they suffer minimal release jitter. Alternatively, the highest-priority level can be used for ET tasks, e.g. sporadic tasks handling urgent events, thus granting prompt reaction to them. This degree of flexibility combines the benefits of TT and ET scheduling to handle competing timing requirements of real-time embedded software.

This previous framework defines a model for the TT part of the system. The model uses work slots to denote time intervals of TT activity, mode-change slots to mark the points in the plan when mode changes are possible, and empty slots to denote unused time intervals at the TT level. The time not used for the execution of TT activities is automatically made available to lower-priority tasks by the underlying priority scheduler. The TT model also introduces concepts such as sliced sequences of TT jobs, or synchronisation slots for ET tasks that further its expressiveness.

While the model proposed in our previous work provides a flexible way to combine time-triggered and event-triggered activities, many modern embedded applications must also support functionalities with different levels of criticality. This has led to the emergence of mixed-criticality systems [5].

Mixed-criticality systems (MCS) are characterised by the coexistence of functionalities with different levels of criticality within the same computing platform. Tasks are therefore assigned a criticality level reflecting the severity of the consequences in case their timing requirements are violated. In this context, different estimates of the worst-case execution time may be associated with each task, typically increasing with the assumed level of assurance. During system operation, the detection of execution-time overruns may trigger a change in the system criticality level. When such events occur, the system must adapt its behaviour in order to guarantee the timing requirements of higher-criticality tasks, possibly by reducing the service provided to lower-criticality activities.

Although relatively flexible, the model proposed in our previous studies exhibited certain shortcomings inherent to static schedules. On the one hand, the assignment of time slots to TT tasks was fixed. In other words, regardless of the system conditions, the maximum execution time available for a given task had to be specified statically in the schedule. If system conditions changed as a result of an event, as occurs in mixed-criticality systems, the only possible adaptation mechanism was to perform an operational mode change, with the corresponding modification of the static schedule.

On the other hand, although the presence of mode-change slots allowed schedule modifications to be performed more flexibly than in classical cyclic executives [1], the system still had to wait until those slots were reached before its behaviour could be altered, at least that of the time-triggered components.

In order to support mixed-criticality systems that include tasks with jitter-sensitive components, this paper extends the approach proposed in previous studies in two directions. First, we reformulate the task model to incorporate task criticality levels while preserving the notion that certain tasks may contain activities with strict activation requirements. Second, we revise the previously proposed execution support to enable the adaptation of static schedules according to the current criticality level of the system.

The proposed framework provides execution support for mixed-criticality systems combining time- and event-triggered tasks. It does not prescribe the policy used to determine when system criticality level (SCL) changes occur, nor does it enforce schedulability guarantees across all criticality levels. Instead, such guarantees are assumed to be ensured by the offline construction and analysis of the scheduling plan.

The remainder of the paper is organised as follows. Section 2 presents the system model. Section 3 introduces the extensions to the time-triggered model required to support mixed-criticality systems. Section 4 describes the proposed timed mode-change mechanism. Section 5 illustrates the behaviour of the framework through a mixed-criticality execution example. Section 6 presents a brief experimental evaluation of the framework, focusing on the activation delays introduced by the proposed mechanisms. Section 7 discusses related work, and Section 8 concludes the paper.

2 System Model

This section describes the system model assumed throughout the paper. It first introduces the task model used to characterise the workload. Then, the execution model defines how jobs are released and executed within the combined time-triggered and event-triggered framework. Finally, the time-triggered model briefly recalls the structure of the TT scheduling framework introduced in our previous work, which serves as the basis for the extensions presented in this paper.

2.1 Task Model

The task model considered in this work is based on the Generalized Multi-Frame (GMF) task model [2]. A task system is composed by several concurrent tasks that are executed on the same processor or computing resource. A task is an entity that generates an infinite sequence of jobs. Each job Ji is characterised by a release time ri, a relative deadline di, and a worst-case execution requirement ei. The sequence of jobs that a task may produce is determined by its workload constraint.

In the GMF model, the workload constraints of a task are defined by the tuple of N-ary vectors (E,D,T). Each frame specifies the parameters of the corresponding jobs generated by the task, and the sequence of frames repeats cyclically every N jobs. The sequence of N jobs produced in each repetition is referred to as a task cycle.

According to this definition, job Ji has a release time ri=ri1+T(i1)modN, a deadline di=DimodN and a worst-case execution time ei=EimodN. Thus, each job corresponds to the corresponding frame in the cycle.

However, in order to support mixed criticality systems in which tasks may have different estimates of the worst-case execution time depending on the criticality level, we replace the execution-time parameter Ef of each frame with the tuple (Ef1,Ef2,,EfL), where L denotes the number of criticality levels in the system. In this representation, a value Efl=0 denotes that the corresponding job is not executed when the system operates at criticality level l.

Additionally, to support jitter-sensitive components within system tasks, each frame is annotated with a flag indicating whether it is jitter-sensitive. This information is only considered during the system design phase, when constructing the execution plan, and during the implementation phase, where it slightly affects the API used by the application. It is not used by the proposed framework at run time.

2.2 Execution Model

The execution system model defines a run-time framework that splits the application in two disjoint subsets of real-time jobs: event-triggered (ET) and time-triggered (TT). Jobs in the ET subset are scheduled by a preemptive, priority-based scheduler. The TT subset is ultimately scheduled by the same priority scheduler, at the priority level assigned to their TT plan; but TT jobs are only released for execution by a specific TT scheduler. The TT scheduler follows an offline designed plan to determine when a TT job must be released and for how long it is allowed to run.

As can be seen, the execution model does not require that all jobs of a multi-frame task be executed either in the TT domain or at a fixed priority within the ET domain. Instead, the jitter-sensitivity flag associated with each frame determines, during the design phase, how the jobs corresponding to that frame are executed. Frames marked as jitter-sensitive have their jobs assigned to slots in the TT schedule, where guarantees on release jitter can be provided. Similarly, high-criticality tasks can also utilise the TT domain to execute their jobs, taking advantage of its interference-free execution and its ability to detect overruns. These capabilities will be discussed later, alongside the other extensions to the previous framework.

When a TT job is released, it is added to the ready queue of the priority level set for the TT plan. Hence it competes for CPU time with the rest of ET jobs at that level or higher. As explained in the following section, at most one TT job can be active at any given time. If the TT plan has the highest priority, then the TT workload takes precedence over the entire ET subset. Otherwise, TT jobs may suffer interference that must be taken into account in the design of the TT plan. The interference caused by higher-priority TT plans must also be accounted for in all lower-priority levels. The previous proposal shows that the schedulability analysis of ET tasks can be performed by modelling the TT plan as a single transaction with static offsets [9], which interferes with ET tasks at the priority level assigned to the TT workload [12].

TT jobs do not need a specific protection mechanism for sharing data among them, since the schedule can be designed to guarantee absence of data corruption. Data sharing between ET jobs and other ET or TT jobs, must however be protected by some concurrent data sharing mechanism, such as Ada protected objects – that is the case in our Ravenscar implementation of the approach.

2.3 Time-Triggered Model

The execution model described above does not modify the way in which the underlying priority scheduler operates, but it defines a model for the representation, and a set of rules for the execution of the TT workload. In this section, a review of how multi-frame tasks can use the execution model to allocate their jobs is presented. However, it should be noted that the main runtime support provided by the framework is centred on the TT domain. Although the framework provides mechanisms to coordinate the TT and ET domains, the support available in the ET domain is inherently more limited. In particular, certain services, such as execution-time overrun detection, cannot be provided under the restrictions imposed by the Ravenscar profile111The proposed framework is implemented using the Ravenscar profile, which does not support the execution-time timers required for a full implementation (No_Dependence => Ada.Execution_Time.Timers).. As a result, only ET tasks that are synchronised with the TT plan can benefit from the criticality level control mechanisms introduced in this paper.

The time-triggered model adopted in this work builds upon the TT scheduling framework introduced in [12], where the execution of TT activities is organised according to a static schedule composed of different types of slots. This static schedule is defined as an ordered sequence of non-overlapping, consecutive time slots, each of a certain non-negative duration. Each slot is taken in order of arrival and lasts for the defined slot duration, time when the next slot is taken. At the start time of a slot, the TT scheduler uses the current slot duration to determine the ending time of the slot, which by definition coincides with the beginning of the next slot. Figure 1 shows a TT plan example with slot types we present bellow.

Figure 1: A time-triggered plan with different slot types.

At run time, the plan is repeated cyclically until power-off or until a mode-change request is processed. The switch to the next mode’s plan takes effect only at designated mode-change slots. Details on mode changes and the corresponding slots are provided in Section 4.

The main types of slots that compose a TT plan are: empty slots, mode-change slots, work slots and synchronisation slots. Although these have already been introduced in previous versions of the framework, we will review their functions here and how they can be used to accommodate jobs of multi-frame tasks.

Empty slots

define time intervals with no TT activity planned for execution. The duration of an empty slot is therefore made available to lower-priority activities in the ET domain, and managed by the underlying priority scheduler. The TT scheduler does not release any job at the start of empty slots, so it does not need to check for overruns at the end of them. Slots numbered as 1, 3, 5, 9 and 11 in Figure 1 are empty slots.

Mode-change slots

define time intervals in the plan when a mode change may occur. Mode changes can be requested by any job (ET or TT) by means of an API primitive, Set_Plan. We detail its full behaviour in Section 4. In Figure 1, slots 7 and 13 labelled with a curly arrow are mode-change slots.

Work slot

is a type representing those slots that trigger the release of TT jobs. TT jobs wait for their corresponding slot by invoking the API operation Wait_For_Activation. In the original model, the full duration of a work slot was reserved for the execution of the released TT job. For such slots, the TT scheduler enforce the strictest constraints: if the job is not waiting when the slot is reached, a fatal error is raised; likewise, if the execution of the job exceeds the allocated slot duration, a fatal exception is also triggered.

This slot had several variants. A work slot with the default behaviour was called a regular slot. If the execution of the corresponding job could exceed the allocated slot duration and resume in a subsequent slot assigned to the same task, the slot was defined as a continuation slot. Finally, if a no-show situation was allowed when the slot was reached (i.e., the job might not be ready at that time), the slot was defined as an optional slot. More details on how these slots can be combined to execute multi-frame tasks can be found in [12].

Sync slots

mark points in the plan at which ET jobs may be released for execution at their corresponding priority level. Although ET jobs can use standard Ada mechanisms to control their activation (e.g. Timing_Events or delay until statements), sync slots provide a way to synchronise job releases with specific points in the TT schedule. To take advantage of this mechanism, the job invokes the API operation Wait_For_Sync. In this way, the activation of ET jobs can be aligned with the global time-triggered schedule and take advantage of the MCS support introduced in the next section. The slot 6 in Figure 1 is a sync slot.

This synchrony of ET tasks with the plan is especially useful, for example, when an ET job consumes data produced by some TT job from a different task. Sync_Slots can be placed in the plan to signal data availability to the ET job, who just needs to wait for the sync slot to arrive. Once released, the job would then consume the data at its assigned priority level, out of the plan.

In previous versions of the framework, ET tasks were not required to be waiting when a synchronisation slot was reached. This behaviour is not suitable for mixed-criticality systems, as it permits additional variability in the execution of ET tasks. Therefore, synchonized ET tasks are now required to comply with the same activation constraints as TT tasks, as described above.

Apart from TT slots, the original framework also provides an extended API that allows the application to modify its behaviour at run time. The operation Continue_Sliced allows the current regular slot to be dynamically converted into a continuation slot. Similarly, the operation Leave_TT_Level allows a job executing in a TT slot to request the continuation of its execution in the ET domain. Although these operations are not strictly required, they avoid the need to introduce additional continuation and sync slots in the plan, thereby reducing unnecessary context switches.

Although the slot types and their main role remain largely unchanged in the current framework, several of the behaviours described above are not well suited to the requirements of mixed-criticality systems. In particular, fixed slot sizes and the strict handling of overruns and no-show situations must be reconsidered so that the system can adapt its behaviour when the criticality level changes.

Alongside the original framework, we proposed a library of TT utilities, to facilitate the implementation of TT schedules, and a library of patterns for TT and ET jobs. We keep updating those libraries to support the extensions and modifications described below [13].

3 Time-Triggered Model Extensions

This section describes the extensions required to support mixed-criticality systems, mainly in the TT scheduler. These extensions address the objectives outlined in the introduction, namely incorporating criticality-awareness into the task and execution models and providing mechanisms to adapt system behaviour according to the current system criticality level (SCL).

The framework focuses on providing execution support for mixed-criticality workloads in a combined TT and ET setting. It deliberately does not define the mechanisms or policies used to trigger changes in the SCL, which are considered application-specific. Instead, the framework provides the necessary mechanisms to support the implementation of different SCL transition protocols. Likewise, the framework does not ensure that all TT tasks meet their timing requirements at all criticality levels. This responsibility is delegated to the offline construction and schedulability analysis of the TT plan for each SCL.

To this end, the proposed framework has been extended along several dimensions, including the integration of system criticality level (SCL) into the execution model, support for multiple execution-time estimates in TT jobs depending on the SCL, and an application-level overrun detection mechanism that may trigger SCL changes. In addition, the framework provides execution-level support for implementing different SCL transition mechanisms, without prescribing the policies that govern when such transitions occur.

Figure 2: Types of slots defined in the TT model.

To support these extensions, both the internal structures of the TT scheduler and the slot types used to construct TT schedules have been adapted. Figure 2 illustrates the updated hierarchy, attributes, and slot operations introduced to support MCS. Their use is described in the corresponding subsections below, in a bottom-up manner.

3.1 TT Jobs Execution

Before analysing the effects of the system criticality level and the effects of SCL changes on ongoing tasks, we begin with the most basic extension to the TT model: the definition of the work-slot duration.

In the original model, the entire duration of a work slot was allocated to the execution of the released TT job. Consequently, overruns were detected only at the end of the slot. In the new model, as shown in Figure 3(a), a work slot is divided into an active part allocated to job execution, referred to as the work duration, and a trailing empty part.

(a) Work slot parts.
(b) Example in a dual criticality level system.
Figure 3: New work slot structure.

The duration of the active part is now defined on a per-criticality-level basis. This allows the system to adapt the work duration of a TT slot to match the execution-time estimate of a job at the current SCL, ranging from zero (i.e., the job is not executed) to a maximum value limited by the slot size. Figure 3(b) shows an example of the use of the new work slot structure for a system with two criticality levels. A natural requirement for the slot size is that it must accommodate the maximum execution-time estimate of job Ji, i.e., eimax=maxlLEil. However, as it is presented in the next subsection, a minimum empty size is recommend to allow the runtime system to handle a possible execution overrun before the end of the slot, avoiding possible release jitters in the next TT slot.

The duration of the work part can be adjusted through the array Work_Size (see Figure 2), indexed by the SCL and used by the default implementation of the function Work_Duration. However, an application-specific extension of the Work_Slot type may override the Work_Duration implementation, allowing more flexible work-slot behaviour, provided that the returned work duration does not exceed the total slot duration.

The padding size shown in Figure 3(a) represents an anticipation time used to safely suspend a job that may continue its execution in the next TT slot (a continuation slot). This margin is required because the job may be executing within a protected operation, which can delay the point at which the suspension request takes effect. Further details on how the support for continuation slots is implemented can be found in [12]. However, since this margin is derived from the execution-time estimate of the longest protected action, its value may also depend on the current SCL.

The complete slot taxonomy in Ada is given in Appendix A.

3.2 Overrun Detection

Once the work duration of a slot has been redefined to account for the SCL, the next extension concerns the run-time behaviour when this time is exceeded. In MCS, an overrun of the execution time allocated at a given criticality level may trigger a criticality-level change. Since the system’s response to such an event is entirely application-specific [5], the previous practice of raising a fatal exception is no longer appropriate. Similarly, imposing a default reaction, such as automatically raising the SCL, would not be appropriate either.

To allow the application to define the appropriate response to execution overruns, the framework provides an API for installing overrun handlers. A system-wide default handler can be registered using the operation Set_Default_Overrun_Handler. Additionally, a task-specific handler may be installed through Set_Specific_Overrun_Handler. When both are defined, the task-specific handler overrides the default handler.

Since these handlers are executed in the context of the TT scheduler, at the same execution priority as TT jobs, their implementation requires careful consideration. A negligent implementation could introduce release jitters in the next work slot, since no execution control can be applied to an event handler. If a non-negligible execution time is required to perform overrun management, beyond simply raising the criticality level or requesting a full mode change, an empty part in the affected TT slot must be provided to accommodate the handler’s execution. Naturally, the worst-case scenario occurs when the TT job has been allocated the largest work duration and an overrun event is triggered222Although this situation would normally trigger a fatal error, because the largest execution-time estimates generally correspond to the highest criticality level, which should not suffer overruns..

After executing an overrun handler, the TT scheduler launches a reschedule event handler. Since an overrun handler can change the SCL or perform any other application-specific action that may modify the work-slot duration, the TT scheduler must reevaluate the current slot, the one that triggered the overrun handler, to determine whether it should continue its execution due to an extended work duration, or a fatal error has to be raised.

3.3 System Criticality Level

The most important concept in a mixed-criticality system is the system criticality level (SCL), which can affect how tasks are executed, or even whether they are executed at all. In the previous subsections, the extensions required to manage the SCL at the TT job level have been presented. However, the more challenging update is to properly handle criticality-level changes at the multi-frame task level. A multi-frame task is supposed to be represented by an entity that generates N jobs according to the task timing constraints, previously defined as a task cycle. Although these sequences were already supported in the previous model, and the previously presented extensions define how the SCL can affect work-slot duration, the effect of a criticality-level change on an ongoing task cycle still needs to be defined. Rules are required to guarantee that the logical integrity of the job sequence within a full task cycle is preserved at run time, even when the SCL changes.

In our semantic model, the jobs that make up a full task cycle are usually triggered from the main loop of an Ada task. Accordingly, one of the main behavioural requirements is that all jobs released within a task cycle execute at the same criticality-level (CL) by default, unless the task explicitly specifies otherwise.

To support this requirement, the model needs introducing two concepts: (1) the system criticality level itself; (2) the concept of an active criticality level, which affects the jobs that compose a given multi-frame task. The latter introduces the need to identify all kinds of TT slots that belong to the same task, as well as the points where the sequence of slots begins and ends.

To this end, the proposed model first adds the notion of system criticality level. The number of criticality levels in a system may be one (meant for non mixed-criticality systems), two, or more. There is a well-defined order among SCLs. The current SCL can be changed to a higher or lower value.

The API functions used to manage system criticality are:

  • Set_System_Criticality_Level, which sets the SCL immediately, except for ongoing tasks as described above;

  • Get_System_Criticality_Level, which returns the current SCL;

  • Set_Active_Criticality_Level, which provides a mechanism to change the active criticality level of a task according to application-defined policies; and

  • Get_Active_Criticality_Level, which returns a task-specific active criticality level. By default, the active criticality level is initialized to the SCL for each newly started task.

Using the getter functions, a task may override the default behaviour333The default behaviour is the one determined by the work duration of the TT slots. of a job and determine that it should execute a different code version or to be temporarily skipped at the current SCL, thereby providing a degraded version of the task if required by the application. In our previous model, the latter can only be achieved if the execution plan includes the appropriate optional slots.

In the new framework, a job may skip its assigned slots either by returning 0 in a customised implementation of the Work_Duration function or by invoking the Skip_Activation procedure. Listing 1 shows how job execution can be selectively bypassed depending on the system criticality level. When using Skip_Activation, if a job spans multiple continuation slots in the TT plan, the scheduler ensures that all slots in the sequence are skipped.

Listing 1: Example illustrating slot skipping based on the system criticality level.
if Get_System_Criticality_Level = LO then
TTS.Wait_For_Activation (Work_Id, Task_State.Release_Time);
-- Job to be executed only when SCL = LO
Do_Job_Work;
else
TTS.Skip_Activation (Work_Id);
end if;

The second concept requires the system to identify both the active criticality level (CL) of an ongoing task and the slots that make up its jobs. To this end, the new framework unifies the identifiers of work and synchronisation slots, allowing a single Work_Id to be associated with a task across all slots in a job sequence, regardless of their type. This enables consistent tracking of task execution across heterogeneous slot types. Figure 2 shows the slot types with the new attributes and the new slot type required to identify the beginning of a task cycle, Initial_Slot.

Each task cycle starts with an initial slot that includes an extra attribute, Criticality_Level, which determines the criticality level of the entire cycle. The value of this attribute can be used as a shortcut when the execution times of all jobs from that criticality level onwards are zero for that task, i.e., i,0iN,l>CL,eil=0.

Using these attributes, the scheduler can identify the slots that belong to a given task cycle and determine its associated criticality level. To preserve the semantic consistency of multi-frame tasks, the scheduler enforces the following rules:

  • The criticality level of a task is determined by that of its initial slot. If the SCL is higher than the task’s CL, no TT job of that task will be executed until the CL is reevaluated for the next task cycle.

  • Once started, a task sequence always runs to completion, despite external changes to the SCL (i.e., those made by other tasks) during its execution.

  • It is, however, allowed for a job within the task itself to raise the SCL from a user-defined overrun handler, with an immediate effect on the active CL of the ongoing task. The remaining jobs of that task will then execute with a work duration corresponding to the new SCL. Changes triggered elsewhere in the code do not take effect on the active CL until the end of the currently running task cycle.

These rules defer the effect of an external SCL change until the end of the last slot of any task that had already started at the time of the change. Although this behaviour reduces the system’s ability to adapt immediately to changes in the SCL, it is the price to pay to preserve the logical integrity of a task. The alternative –applying SCL changes immediately to ongoing task sequences– raises complex semantic issues. However, the procedure Set_Active_Criticality_Level allows the application to override this default behaviour if required.

A task cycle may be composed of different types of slots assigned to its jobs, including synchronised and optional parts. The proposed model applies to sequences formed by arbitrary mixtures of slot types. The only requirement is the consistent use of the Is_Initial attribute so that the scheduler can identify an ongoing task cycle.

An additional rule applies to the activation of task cycles. If the initial slot of a task cycle is optional and is not taken, reports a zero Work_Duration, or is explicitly skipped, the entire task cycle is considered not taken and its execution is skipped.

The new API of the proposed framework is provided in Appendix B.

4 Timed Mode-Change Extensions

In the original model, a mode-change request takes effect exactly at the end of the next mode-change slot in the plan. Although several mode-change slots can be carefully placed in the schedule to ensure that the semantic consistency of multi-frame tasks is preserved, this strict timing restriction limits some practical extensions. One particularly useful capability is the possibility of re-synchronising schedules, for example to compensate for clock drift in distributed applications.

To support this behaviour, the original mode-change semantics is relaxed to allow the requester of a mode change to specify the intended exact time at which the change should take place. If the given time falls within the duration of a mode-change slot, the slot is immediately abandoned and the new plan starts at that point. In this case, the current plan is effectively truncated at the requested time. If the given time falls outside a mode-change slot, then the change takes place at the beginning of the next mode-change slot. Timed mode changes are useful to coordinate the operation of parallel or distributed schedules, or to synchronise a schedule with an external event, not necessarily a time event defined in the plan.

This extension preserves the role of mode-change slots as safe synchronisation points while allowing mode-change requests to target a specific intended time.

A mode-change request overrides any previously pending request; there is no buffering of requests. However, to maintain backward compatibility when precise timing is not required for the mode change, the TT scheduler may react in two different ways to a mode-change request:

  • Default mode change – Occurs when the mode change is requested by calling Set_Plan with a single parameter, the next plan to execute. The change takes effect at the end of the first mode-change slot occurring after the request.

  • Timed mode change – Occurs when the call to Set_Plan includes a second, optional parameter specifying the intended time for the mode change to occur. If the given time falls within the interval of a mode-change slot, the change becomes effective at that precise time and the slot is aborted at that point, when the new plan starts. If the given time falls outside a mode-change slot, the change takes effect at the beginning of the next mode-change slot, i.e., as soon as possible after the specified time. If no plan is currently running (e.g., at system startup), the new plan starts immediately if no start time is given, or if the specified time lies in the past; otherwise, it starts at the specified time.

5 Mixed-Criticality Execution Example

In this section we explore the expressiveness and adequacy of the defined TT model for systems with multiple criticality levels. To that end, we use a prototypical application with no specific real-life purpose. The application has two criticality levels, HI and LO, with the usual high- and low-criticality meaning.

The top part of Figure 4 shows the TT plan followed by this application. It is formed by 12 slots of fixed slot size, for a total plan duration of 1650 ms. Slot boundaries are marked with short segments in the upper side of the plan. Since work slots are distributed throughout the schedule, the empty part in most of the work slots is used to avoid introducing dedicated empty slots. Darker grey boxes represent time allocated only to HI criticality tasks. A lighter grey indicates LO criticality time. White areas denote spare time in the plan. Some slots are of different work size depending on the criticality level. Such slots (e.g. the third of the plan, marked with Id. 3) are depicted as a light-grey box of the work duration for LO criticality mode, followed by a dark grey box indicating the additional time available in HI criticality mode. Hence the available time for this TT task in HI criticality is 50 ms.

The line on top indicates the Work_Id used by the slot. The last slot, tagged with a curly arrow inside the slot, is a mode-change slot. However, in this application, it has the effect of an empty slot, since we do not replace or re-synchronise this plan. The Ada code used to generate this TT plan using the TT_Utilities package is provided in Appendix C.

Figure 4: Mixed-criticality application example. TT plan (top) and corresponding application works (bottom).

The bottom part of Figure 4 shows the task structure used by the application. There are two tasks, Seq_1 and Seq_2, that executes multiple jobs using TT slots. They have a so called IMs-F structure, one of the patterns defined in [12]. The name indicates that the sequence has an initial part glued to a sliced mandatory part, and then the job completes with a final part. Hence the name, from Initial, Mandatory sliced and Final parts. The initial part in the IMs-F pattern ends with a call to the API service Continue_Sliced to transform the work slot into a continuation slot until the end of it. So the sliced sequence starts in the IMs part. In addition to the time spent in the initial slot, Seq_1 may use two additional slots for the mandatory sliced part. Note that the last slot of the sliced sequence is not a continuation slot, because it requires overrun control, rather than simply holding the task if it is still running at the end of the slot. The sequence Seq_2 uses just one additional slot for the Ms part.

Task Seq_1 is of criticality HI, so it is taken regardless of the current SCL. In LO criticality, the Ms and F parts have slots of a shorter work duration, but they are given extra time during HI criticality. Task Seq_2 is of LO criticality, hence it is only taken if the SCL is LO at time 50 ms. If there is a change to HI during the execution of Seq_2, then the task cycle is allowed to run to completion, even though it uses LO criticality slots. Tasks Wk_3, Wk_4 and Seq_5 are testers of proper managing of criticality levels by the scheduler. Works Wk_3 and Wk_4 are single job TT tasks, i.e., they just use one regular work slot for their unique jobs. Task Wk_3 is of HI criticality, and Wk_4 is LO. Task Seq_5 implements another complex task pattern formed by an initial part that uses a sync slot to release an ET task, which may optionally require a final part at the TT domain. In the new framework, this task uses a unified Work_Id = 5 for both the initial synchronised part and the final TT part, since both belong to the same execution sequence.

Figure 5 illustrates a possible system execution, where the active criticality level of each task is indicated by the grey shading of its executed jobs. The application starts at LO criticality level. The SCL may then be changed at two points of the plan. We have programmed Seq_1 so that once every two iterations of the plan, it causes an overrun of its LO work duration at the end of the mandatory sliced part. The overrun handler simply changes the SCL to HI, so that the task immediately continues execution using the extended time for that level. We also check that task Seq_2 runs to completion, unaffected by the SCL change in the middle of the task cycle. And the same for the task Seq_5: the optional final part is taken if the Sync’ed initial part so decided, even when Seq_1 raises the SCL in between the initial and final parts of Seq_5. However, task Wk_4 does not execute, since the SCL is already HI when it reaches its initial slot. Missed task releases are signalled with a green downward arrow in Figure 5.

Figure 5: Mixed-criticality execution example.

The other point where the SCL may change is due to the effect of Wk_3, which blindly sets the SCL to LO at the end of its only job. As Figure 5 shows, tasks Seq_1 and Wk_3 start the second round at HI criticality level. Task Seq_1 does not change its active CL until the end of its task cycle, since the SCL is changed externally to LO by task Wk_3. Task Wk_4 also starts normally, but at LO criticality level, since the SCL has returned to LO before its TT slot is reached. In contrast, task Seq_2 is not executed at all, since the SCL is HI when the task reaches its initial slot. This behaviour follows the rules defined in Section 3.3.

6 Performance evaluation

To approximately quantify the scheduler overhead in our implementation of the model [14], and grasp an idea of the scheduler performance, we have measured the release delays incurred by the tasks in any possible combination of ending and starting slots. In the new version of the TT scheduler, the handling of Next_Slot and End_Of_Work events has been separated into distinct handlers. As a result, slot termination behaviour is determined by whether the task must be suspended at the end of the slot (i.e., in continuation slots, labeled as Hold) or has already completed before the end of the slot (Others). Slot activation, in turn, depends on both the slot type and whether it corresponds to the initial slot of a sequence. The maximum job release delays measured on an STM32F4 Discovery board running at 168 MHz, with clock interrupt period configured as 10μs, are reported in Table 1.

Table 1: Maximum measured release delays using TT scheduler (microseconds).
Starting slot
Ending slot Initial Regular Initial Sync Sync Initial Cont. Continuation
Hold 31.24 29.79 29.22 27.49 32.07 30.60
Others 23.38 21.73 21.31 20.06 24.44 22.71
Table 2: Maximum measured release delays using Ada mechanisms (microseconds).
Release mechanism
Activation PO entry PO + Suspension Object
Immediate 7.26 6.43
Timing Event 12.62 11.98

Table 1 shows that processing task suspension prior to activating the next slot increases the release delay by up to 8 μs. The maximum observed delay is 32.07 μs and occurs when a slot marking the start of a task cycle is also a continuation slot, as this case involves the largest number of scheduler operations.

In the previous version of the framework, the longest release delay recorded on the same board was 36.7 μs, slightly higher than the current value. At first sight, one might expect the previous version to exhibit lower overhead, given its simpler execution model. However, the measurements indicate the opposite. This difference is due to a custom modification in the current runtime implementation of Timing Events, which allows the start time of the TT plan to be resynchronised with the system periodic clock. This prevents an extra periodic tick from being inserted when the timing event is programmed.

Although the times shown for each type of activation in Table 1 are very stable (with less than 0.4 μs variation between minimum and maximum values), differences in the amount of work performed across the cases result in a 12.08 μs variation between activation types; a much wider range than in the previous framework.

To compare the overhead of the proposed framework, standard Ada mechanisms for task activation have also been evaluated using the same run-time. Table 2 reports the results obtained when a task is activated via a Protected entry or through a Suspension Object controlled by a Protected Object. For each case, the release delay is measured both for immediate activation and for activation triggered from a Timing Event handler. Given that timing events are used together with suspension objects in the TT scheduler implementation, the resulting overhead of our proposal can be estimated to lie between 10 and 20 μs.

7 Related Work

To the best of our knowledge, there is no previous work proposing variable-duration slots in a TT model definition. Neither have we found the extended semantics of mode-change slots presented in this paper.

The issue of bringing mixed criticality to TT systems has been previously addressed from different perspectives. In [15] and [8], the authors propose methods to build static schedules so that they guarantee a combination of requirements, among which is the criticality level. The static nature of the schedules obtained by these methods ultimately requires the plan to allocate slots for all tasks, despite their criticality. Hence in these frameworks there is no real concept of system criticality level as a mechanism to reduce the demand of low-criticality tasks when the system is in a higher-criticality level.

A less static approach to mixed-criticality in TT systems is proposed in [3]. Rather than a single TT schedule for all tasks of all criticality levels, multiple modes (schedules) are defined, one for each criticality level. With one defined schedule per level, criticality-aware workload balancing is possible via mode changes. The authors assume the mode-change transition to be immediate. This is an assumption we cannot make in our model, as it would break the semantic consistency of multi-frame tasks if there are ongoing task cycle at the time of the mode change. In our proposed model, one could place mode-change slots at points that do not break any task cycle. But letting an overrunning task to immediately transition to a higher criticality level and continue execution, as we are proposing, is a more effective response to the event while the mode-change slot is reached. The consistency of task cycles is preserved by the rules described in Section 3.3.

A third approach to the issue is proposed in [16], based on the slot-shifting technique [7]. The slot-shiting technique analyses a static legacy TT plan to find spare times in the plan for insertion of sporadic or aperiodic workload by shifting (delaying) the release of TT tasks to a point where they remain schedulable, thus promptly leaving time for ET tasks, at the expense of release jitter for TT tasks. This technique requires an online mechanism to handle changes of criticality. In our combined ET-TT scheduling framework, the planned TT tasks are never explicitly delayed by the scheduler, although they will be naturally delayed if ET urgent tasks are assigned a higher priority than the TT scheduler.

8 Conclusion

In previous publications, we defined a hierarchical architecture for the execution of systems combining event- and time-triggered workloads. The ET workload is scheduled by an underlying priority scheduler and the TT workload is executed by a purely time-triggered scheduler running on the same runtime support. The architecture helps simplifying the TT plan, since the ET workload can be moved out of it, and it also opens the possibility of collaboration between both scheduling domains. Along with the architecture definition, we provided a library of useful programming patterns for multi-frame TT tasks, and ET tasks that synchronise with the TT plan; and a library of utilities to define slots and build TT plans [14].

In this work, we have focussed on the TT part of the model to make it more flexible and expressive, so that it makes it possible for the static plan to adapt to mixed criticality systems. We have identified and applied a relatively small number of changes to the original model, with promising initial results demonstrated by an illustrative example. We have also defined the rules that help preserve the semantic consistency of multi-frame tasks when a change in the criticality level catches them in the middle of a task cycle.

With the proposed changes, the originally proposed model has gained: (i) the flexibility of variable-duration slots and timed mode changes; and (ii) criticality awareness and user-defined handling of overruns, for user-defined criticality management. In our view, the model opens the possibilities of TT schedules to cope with time-varying requirements in a way that does not seem achievable in the more classic, purely static TT framework.

As future work, we plan to extend the framework to support mixed-criticality management in the event-triggered domain. Event-triggered tasks are already supported through a priority-based scheduler and may be activated in coordination with the time-triggered plan, thereby inheriting a degree of mixed-criticality control. However, this support is currently limited, as activations are strictly driven by the TT plan and cannot follow independent periodic or sporadic patterns. In addition, execution overrun detection is not available in the ET domain due to the constraints of the Ravenscar profile, which prohibits execution-time monitoring. We further envision the introduction of a flexible event-triggered plan to regulate multi-frame execution and provide more expressive activation and control mechanisms in the ET domain. Providing such capabilities would enable a more uniform integration of TT and ET components under mixed-criticality assumptions.

References

  • [1] Theodore P. Baker and Alan C. Shaw. The cyclic executive model and Ada. In Proceedings of the 9th IEEE Real-Time Systems Symposium (RTSS ’88), December 6-8, 1988, Huntsville, Alabama, USA, pages 120–129. IEEE Computer Society, 1988. doi:10.1109/REAL.1988.51108.
  • [2] Sanjoy K. Baruah, Deji Chen, Sergey Gorinsky, and Aloysius K. Mok. Generalized multiframe tasks. Real Time Syst., 17(1):5–22, July 1999. doi:10.1023/A:1008030427220.
  • [3] Sanjoy K. Baruah and Gerhard Fohler. Certification-cognizant time-triggered scheduling of mixed-criticality systems. In Proceedings of the 32nd IEEE Real-Time Systems Symposium, RTSS 2011, Vienna, Austria, November 29 - December 2, 2011, pages 3–12, Vienna, Austria, november-december 2011. IEEE Computer Society. doi:10.1109/RTSS.2011.9.
  • [4] Alan Burns. The ravenscar profile. Ada Lett., XIX(4):49–52, December 1999. doi:10.1145/340396.340450.
  • [5] Alan Burns and Robert I. Davis. A survey of research into Mixed Criticality Systems. ACM Comput. Surv., 50(6):82:1–82:37, 2017. doi:10.1145/3131347.
  • [6] Alan Burns, Brian Dobbing, and Tullio Vardanega. Guide for the use of the Ada Ravenscar Profile in high integrity systems. Ada Lett., XXIV(2):1–74, June 2004. doi:10.1145/997119.997120.
  • [7] Gerhard Fohler. Joint scheduling of distributed complex periodic and hard aperiodic tasks in statically scheduled systems. In IEEE Computer Society Press, editor, 16th IEEE Real-Time Systems Symposium, Palazzo dei Congressi, Via Matteotti, 1, Pisa, Italy, December 4-7, 1995, Proceedings, pages 152–161, Pisa, Italy, December 1995. IEEE Computer Society. doi:10.1109/REAL.1995.495205.
  • [8] Dip Goswami, Martin Lukasiewycz, Reinhard Schneider, and Samarjit Chakraborty. Time-Triggered Implementations of Mixed-Criticality Automotive Software. In Design, Automation and Test in Europe Conference and Exhibition (DATE), Dresden, Germany, March 2012. IEEE. doi:10.1109/DATE.2012.6176680.
  • [9] J. Carlos Palencia, Michael González Harbour, J. Javier Gutiérrez, and Juan M. Rivas. Response-time analysis in hierarchically-scheduled time-partitioned distributed systems. IEEE Trans. Parallel Distrib. Syst., 28(7):2017–2030, July 2017. doi:10.1109/TPDS.2016.2642960.
  • [10] Jorge Real and Sergio Sáez. Time-Triggered Scheduling in Ravenscar (source code, version 0.3.0). DOI: 10.5281/zenodo.3490505, July 2019.
  • [11] Jorge Real, Sergio Sáez, and Alfons Crespo. Combined Scheduling of Time-Triggered and Priority-Based Task Sets in Ravenscar. In A. Casimiro and P. Ferreira, editors, Reliable Software Technologies – Ada-Europe 2018, volume 10873 of Lecture Notes in Computer Science, Cham, June 2018. Springer International Publishing. doi:10.1007/978-3-319-92432-8_7.
  • [12] Jorge Real, Sergio Sáez, and Alfons Crespo. A hierarchical architecture for time- and event-triggered real-time systems. Journal of Systems Architecture, 101, December 2019. doi:10.1016/j.sysarc.2019.101652.
  • [13] Sergio Sáez and Jorge Real. TTS Ravenscar runtime source code. Latest version. https://github.com/sergio-saez-barona/tts-runtime-ravenscar.
  • [14] Sergio Sáez and Jorge Real. TTS Ravenscar runtime source code. (version 0.5.0). https://doi.org/10.5281/zenodo.19636270, April 2026.
  • [15] Domitian Tamas-Selicean, Paul Pop, and Wilfried Steiner. Synthesis of communication schedules for ttethernet-based mixed-criticality systems. In Ahmed Jerraya, Luca P. Carloni, Naehyuck Chang, and Franco Fummi, editors, Proceedings of the 10th International Conference on Hardware/Software Codesign and System Synthesis, CODES+ISSS 2012, part of ESWeek ’12 Eighth Embedded Systems Week, Tampere, Finland, October 7-12, 2012, pages 473–482. ACM, ACM, October 2012. doi:10.1145/2380445.2380518.
  • [16] Jens Theis and Gerhard Fohler. Mixed criticality scheduling in time-triggered legacy systems. In 1st International Workshop on Mixed Criticality Systems (WMC), Vancouver, Canada, December 2013. IEEE.

Appendix A Ada Framework Type definitions

This appendix summarises the type definitions used by the framework, including the data types required to configure slots, plans, and criticality-related parameters.

generic
type Criticality_Levels is (<>);
Number_Of_Works : Positive := 1;
TT_Priority : System.Priority := System.PriorityLast;
package XAda.Dispatching.TTS is
-- TT/ET tasks use a Work_Id of this type to identify themselves
-- when they call the scheduler
subtype TT_Work_Id is Positive range 1 .. Number_Of_Works;
-- An abstract time slot in the TT plan
type Time_Slot is abstract tagged record
Slot_Size : Ada.Real_Time.Time_Span;
end record;
type Any_Time_Slot is access all Time_SlotClass;
-- An empty time slot
type Empty_Slot is new Time_Slot with null record;
type Any_Empty_Slot is access all Empty_SlotClass;
-- A mode change time slot
type Mode_Change_Slot is new Time_Slot with null record;
type Any_Mode_Change_Slot is access all Mode_Change_SlotClass;
-- A work slot
type Time_Span_Array is
array (Criticality_Levels) of Ada.Real_Time.Time_Span;
type Work_Slot_Type is (Regular, Continuation, Sync);
type Work_Slot (Work_Type : Work_Slot_Type) is new Time_Slot with record
Work_Id : TT_Work_Id;
Is_Optional : Boolean := False;
case Work_Type is
when Regular | Continuation =>
Work_Sizes : Time_Span_Array;
Padding_Sizes : Time_Span_Array :=
(others => Ada.Real_Time.Time_Span_Zero);
when Sync =>
null;
end case;
end record;
type Any_Work_Slot is access all Work_SlotClass;
-- A Initial slot
type Initial_Slot (Work_Type : Work_Slot_Type) is
new Work_Slot (Work_Type => Work_Type)
with record
Criticality_Level : Criticality_Levels := Criticality_LevelsFirst;
end record;
type Any_Initial_Slot is access all Initial_SlotClass;
-- Types representing/accessing TT plans
type Time_Triggered_Plan is array (Natural range <>) of Any_Time_Slot;
type Time_Triggered_Plan_Access is access all Time_Triggered_Plan;
...
end XAda.Dispatching.TTS;

Appendix B Complete Framework API

This appendix provides the complete application programming interface of the proposed framework, including all publicly available operations for plan control, synchronisation, and criticality management.

-- Set new TT plan to start at a given time, if time is within a mode change slot.
-- If time is before the next mode change slot, the plan will start at the beginning
-- of that mode change slot.
-- If no time is given, it will be set to the end of the next mode change slot.
procedure Set_Plan
(TTP : Time_Triggered_Plan_Access;
At_Time : Ada.Real_Time.Time := End_Of_MC_Slot);
-- TT works use this procedure to wait for their next assigned TT slot
-- The When_Was_Released result informs caller of slot starting time
procedure Wait_For_Activation
(Work_Id : TT_Work_Id; When_Was_Released : out Ada.Real_Time.Time);
-- ET works use this procedure to wait for their next asigned sync slot
-- The When_Was_Released result informs caller of slot starting time
procedure Wait_For_Sync
(Work_Id : TT_Work_Id; When_Was_Released : out Ada.Real_Time.Time);
-- TT works use this procedure to inform the TT scheduler they want to skip
-- their next assigned slot
procedure Skip_Activation (Work_Id : TT_Work_Id);
-- TT works use this procedure to inform that the critical part
-- of the current slot has been finished. It tranforms the current
-- slot in a continuation slot
procedure Continue_Sliced;
-- TT works use this procedure to inform the TT scheduler that
-- there is no more work to do at TT priority level
procedure Leave_TT_Level;
-- Returns current slot
function Get_Current_Slot return Any_Time_Slot;
-- Returns the first time the first slot of the current plan was released.
-- It is equivalent to an Epoch for the current plan.
function Get_First_Plan_Release return Ada.Real_Time.Time;
-- Returns the last time the first slot of the plan was released
function Get_Last_Plan_Release return Ada.Real_Time.Time;
-- Sets the default overrun handler
procedure Set_Default_Overrun_Handler
(Handler : Ada.Real_Time.Timing_Events.Timing_Event_Handler);
-- Sets the overrun handler for a given Work_Id
procedure Set_Specific_Overrun_Handler
(Work_Id : TT_Work_Id;
Handler : Ada.Real_Time.Timing_Events.Timing_Event_Handler);
-- Sets the system criticality level
procedure Set_System_Criticality_Level (New_Level : Criticality_Levels);
-- Returns the current criticality level of the system
function Get_System_Criticality_Level return Criticality_Levels;
-- Sets the active criticality level of a given work
procedure Set_Active_Criticality_Level
(Work_Id : TT_Work_Id; New_Level : Criticality_Levels);
-- Returns the active criticality level in a given work
function Get_Active_Criticality_Level
(Work_Id : TT_Work_Id) return Criticality_Levels;

Appendix C Ada Code for the Example Scheduling Plan

This appendix provides the Ada code used to construct the scheduling plan of the example presented in Section 5. It illustrates the practical use of the framework interfaces for defining slots, task sequences, and criticality-related behaviour.

------------------------------------------------------
-- @file: tts_plan_d.ads
-- @input: plan_d.tts
-- @note: Code generated by ada-sched-tool
------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with System;
with XAda.Dispatching.TTS;
with TT_Mixed_Criticality; use TT_Mixed_Criticality;
with TT_Utilities;
generic
TT_Priority : System.Priority := System.PriorityLast;
package TTS_Plan_D is
subtype Criticality_Levels is Dual_Criticality_Levels;
Number_Of_Works : constant Positive := 5;
package TTS is new XAda.Dispatching.TTS
(Criticality_Levels, Number_Of_Works, TT_Priority);
package TTU is new TT_Utilities (TTS);
use TTU;
ms : constant Time_Span := Milliseconds (1);
us : constant Time_Span := Microseconds (1);
zero : constant Time_Span := Time_Span_Zero;
-- The TT plan
Plan_D : aliased TTS.Time_Triggered_Plan :=
(-- 0-50
-- 01 Seq. 1, IMs part
TT_Slot (Initial, 50 * ms, 1,
Criticality => HI, Work_Durations => (LO => 50 * ms, HI => 50 * ms)),
-- 50-400
-- 02 Seq. 2, IMs part
TT_Slot (Initial, 350 * ms, 2,
Criticality => LO, Work_Durations => (LO => 30 * ms, HI => zero)),
-- 400-550
-- 03 Single slot for Worker 3
TT_Slot (Initial, 150 * ms, 3,
Criticality => HI, Work_Durations => (LO => 30 * ms, HI => 50 * ms)),
-- 550-750
-- 03 Seq. 1, continuation of Ms part
TT_Slot (Continuation, 200 * ms, 1,
Work_Durations => (LO => 30 * ms, HI => 50 * ms)),
-- 750-900
-- 04 Initial Sync Point for Seq. 5
TT_Slot (Initial_Sync, 150 * ms, 5,
Criticality => LO),
-- 900-1050
-- 05 Seq. 1, terminal of Ms part
TT_Slot (Regular, 150 * ms, 1,
Work_Durations => (LO => 30 * ms, HI => 50 * ms)),
-- 1050-1150
-- 06 Seq. 2, terminal of Ms part
TT_Slot (Regular, 100 * ms, 2,
Work_Durations => (LO => 30 * ms, HI => zero)),
-- 1150-1300
-- 07 Seq. 1, F part
TT_Slot (Final, 150 * ms, 1,
Work_Durations => (LO => 30 * ms, HI => 50 * ms)),
-- 1300-1450
-- 08 Seq. 2, F part
TT_Slot (Final, 150 * ms, 2,
Work_Durations => (LO => 30 * ms, HI => zero)),
-- 1450-1500
-- 09 Single slot for Worker 4
TT_Slot (Initial, 50 * ms, 4,
Criticality => LO, Work_Durations => (LO => 40 * ms, HI => zero)),
-- 1500-1570
-- 10 F part of Seq. 5
TT_Slot (Final, 70 * ms, 5,
Work_Durations => (LO => 30 * ms, HI => zero)),
-- 1570-1650
-- 11 Mode change slot
TT_Slot (Mode_Change, 80 * ms )
);
end TTS_Plan_D;