package independent_tasks public thread a_task end a_task; thread implementation a_task.Impl properties Dispatch_Protocol => Periodic; end a_task.Impl; process node_a end node_a; process implementation node_a.Impl subcomponents T1 : thread a_task.Impl; T2 : thread a_task.Impl; properties Period => 10 ms applies to T1; Deadline => 10 ms applies to T1; Compute_Execution_Time => 1 ms .. 2 ms applies to T1; Priority => 1 applies to T1; Period => 5 ms applies to T2; Deadline => 5 ms applies to T2; Compute_Execution_Time => 1 ms .. 1 ms applies to T2; Priority => 2 applies to T2; end node_a.Impl; processor cpu properties Scheduling_Protocol=>(POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL); end cpu; system root end root; system implementation root.Impl subcomponents process1 : process node_a.Impl; cpu1 : processor cpu; properties Actual_Processor_Binding => (reference (cpu1)) applies to process1; end root.Impl; end independent_tasks;The model above contains a process component called node_a.impl which models the software side and a processor component named cpu for the hardware side. The overall system is modeled by the root.Impl component, in which, the software mapping on the hardware is specified by the property assignment Actual_Processor_Binding.
#include ... void T1_spg (void) { printf ("Thread T1: i am running and displays a message\n"); fflush (stdout); } void T2_spg (void) { printf ("Thread T2: i am running and displays a message\n"); fflush (stdout); }If the C functions are stored in a file called independent_tasks.c, the AADL model must be extended as follow to specify the relationships between the C functions and the AADL threads:
subprogram T1_spg properties source_language => C; source_name => "T1_spg"; source_text => ("independent_tasks.c"); end alarme_spg; subprogram T2_spg properties source_language => C; source_name => "T2_spg"; source_text => ("independent_tasks.c"); end lampe_spg; thread a_task properties Dispatch_Protocol => periodic; end a_task; thread implementation a_task.T1 calls c : { s : subprogram T1_spg; }; end a_task.T1; thread implementation a_task.T2 calls c : { s : subprogram T2_spg; }; end a_task.T2; process implementation Application.Impl subcomponents T1 : thread a_task.T1; T2 : thread a_task.T2; properties ...Running the application built by Ocarina is another step towards the real implementation, as it allows to the AADL designer to see the result on a given target of his design. To see how to build the application and how to run it with Ocarina, see case study 1. To run it, first we must ask to Ocarina to generate the glue code between related our AADL mode, which can be made by:
ocarina -x scenario.aadlThis command should generate a folder named node_a in which is stored the source code of the application.
system root properties Ocarina_Config::Timeout_Property => 4000ms; Ocarina_Config::Referencial_Files => ("node_a", "node_a.ref"); Ocarina_Config::AADL_Files => ("case_study1.aadl"); Ocarina_Config::Generator => polyorb_hi_c; Ocarina_Config::Needed_Property_Sets => (value (Ocarina_Config::Data_Model), value (Ocarina_Config::Deployment), value (Ocarina_Config::Cheddar_Properties)); Ocarina_Config::AADL_Version => AADLv2; end root; system implementation root.Impl end root.Impl;This AADL parameter file will ask Ocarina to produce the source code of this AADL model in a folder called node_a. polyorb_hi_c will be used as target, i.e. PolyORB is a middleware for high critical systems implemented in both C and Ada. We ask here Ocarina to generate the C code the C implementation of PolyORB.
cd node_a makeAt compilation completion, you should find an executable named node_a in the folder node_a, executable which can be run from your shell.
Static, Round_Robin_Protocol, POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL, FixedTimeline, Cooperative, RMS, DMS, EDF, SporadicServer, SlackServer or ARINC653.
SporadicServer, FixedTimeline, PARAMETRIC_PROTOCOL, EARLIEST_DEADLINE_FIRST_PROTOCOL, LEAST_LAXITY_FIRST_PROTOCOL, RATE_MONOTONIC_PROTOCOL, DEADLINE_MONOTONIC_PROTOCOL, ROUND_ROBIN_PROTOCOL, TIME_SHARING_BASED_ON_WAIT_TIME_PROTOCOL, POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL, D_OVER_PROTOCOL, MAXIMUM_URGENCY_FIRST_BASED_ON_LAXITY_PROTOCOL, MAXIMUM_URGENCY_FIRST_BASED_ON_DEADLINE_PROTOCOL, TIME_SHARING_BASED_ON_CPU_USAGE_PROTOCOL, HIERARCHICAL_CYCLIC_PROTOCOL, HIERARCHICAL_ROUND_ROBIN_PROTOCOL, HIERARCHICAL_FIXED_PRIORITY_PROTOCOL, HIERARCHICAL_PARAMETRIC_PROTOCOL, HIERARCHICAL_OFFLINE_PROTOCOL, STATIC, RR, RM, RMS, DM, HPF, EDF, LLF, ARINC653, CYCLIC, OFFLINE.
Rate_Monotonic_Protocol, Deadline_Monotonic_Protocol, Posix_1003_Highest_Priority_First_Protocol, Earliest_Deadline_First_Protocol, Least_Laxity_First_Protocol, D_Over_Protocol, Maximum_Urgency_First_Based_On_Laxity_Protocol, Maximum_Urgency_First_Based_On_Deadline_Protocol, Round_Robin_Protocol, Time_Sharing_Based_On_Cpu_Usage_Protocol, Time_Sharing_Based_On_Wait_Time_Protocol
Hierarchical_Cyclic_Protocol, Hierarchical_Round_Robin_Protocol, Hierarchical_Fixed_Priority_Protocol, Hierarchical_Offline_Protocol, Hierarchical_Polling_Aperiodic_Server_Protocol, Hierarchical_Priority_Exchange_Aperiodic_Server_Protocol, Hierarchical_Sporadic_Aperiodic_Server_Protocol, Hierarchical_Deferrable_Aperiodic_Server_Protocol
DAG_highest_level_first_estimated_times_protocol, Reduction_To_Uniprocessor_protocol, Earliest_Deadline_Zero_Laxity_protocol, Largest_Local_Remaining_Execution_First_Protocol, Proportionate_Fair_PF_Protocol, Proportionate_Fair_PD_Protocol, Proportionate_Fair_PD2_Protocol
Compiled_User_Defined_Protocol, Automata_User_Defined_Protocol, Pipeline_User_Defined_Protocol, User_Defined_Protocol
AADLInspector | OSATE2 | Cheddar ADL |
---|---|---|
Periodic | Periodic | Periodic_Type |
Sporadic | Sporadic | Sporadic_Type |
Aperiodic | Aperiodic | Aperiodic_Type |
Timed | Timed | Periodic_Type or Sporadic_Type |
Hybrid | Hybrid | Periodic_Type or Sporadic_Type |
Background | Background | Aperiodic_Type |
Interrupt | ? | Sporadic_Type |
package case_study1 public thread a_task properties Dispatch_Protocol => Periodic; end a_task; thread T1 extends a_task end T1; thread implementation T1.Impl end T1.Impl; thread T2 extends a_task end T2; thread implementation T2.Impl end T2.Impl; thread T3 extends a_task end T3; thread implementation T3.Impl end T3.Impl; process Application end Application; process implementation Application.Impl subcomponents T1 : thread T1.Impl; T2 : thread T2.Impl; T3 : thread T3.Impl; properties Period => 29 ms applies to T1; Deadline => 29 ms applies to T1; Compute_Execution_Time => 1 ms .. 7 ms applies to T1; Priority => 1 applies to T1; Period => 5 ms applies to T2; Deadline => 5 ms applies to T2; Compute_Execution_Time => 1 ms .. 1 ms applies to T2; Priority => 3 applies to T2; Period => 10 ms applies to T3; Deadline => 10 ms applies to T3; Compute_Execution_Time => 1 ms .. 2 ms applies to T3; Priority => 2 applies to T3; end Application.Impl; processor cpu properties Scheduling_Protocol=>(RMS); end cpu; system root end root; system implementation root.Impl subcomponents process1 : process application.Impl; cpu1 : processor cpu; properties Actual_Processor_Binding => (reference (cpu1)) applies to process1; end root.Impl; end case_study1;
subprogram T1_spg properties source_language => (C); source_name => "T1_spg"; source_text => ("case_study1.c"); end T1_spg; thread T1 extends a_task end T1; thread implementation T1.Impl calls c : { s : subprogram T1_spg; }; end T1.Impl;
#include ... void T1_spg (void) { printf ("[%d] Thread T1 is released\n", milliseconds_since_epoch()); fflush (stdout); } void T2_spg (void) { printf ("[%d] Thread T2 is released\n", milliseconds_since_epoch()); fflush (stdout); } void T3_spg (void) { printf ("[%d] Thread T3 is released\n", milliseconds_since_epoch()); fflush (stdout); }
package case_study2 public thread a_task end a_task; thread implementation a_task.Impl properties Dispatch_Protocol => Periodic; end a_task.Impl; process Application end Application; process implementation Application.Impl subcomponents T1 : thread a_task.Impl; T2 : thread a_task.Impl; T3 : thread a_task.Impl; properties Period => 12 ms applies to T1; Deadline => 12 ms applies to T1; Compute_Execution_Time => 1 ms .. 5 ms applies to T1; Period => 6 ms applies to T2; Deadline => 6 ms applies to T2; Compute_Execution_Time => 1 ms .. 6 ms applies to T2; Period => 24 ms applies to T3; Deadline => 24 ms applies to T3; Compute_Execution_Time => 1 ms .. 5 ms applies to T3; end Application.Impl; processor cpu properties Scheduling_Protocol=>(EDF); end cpu; system root end root; system implementation root.Impl subcomponents process1 : process application.Impl; cpu1 : processor cpu; properties Actual_Processor_Binding => (reference (cpu1)) applies to process1; end root.Impl; end case_study2;
Threads | Worst case execution time | Release time | Priority | Policy |
---|---|---|---|---|
other1 | 8 ms | 0 | 0 | SCHED_OTHER |
rr1 | 5 ms | 2 | 3 | SCHED_RR |
rr2 | 5 ms | 2 | 3 | SCHED_RR |
fifo1 | 3 ms | 3 | 4 | SCHED_FIFO |
fifo2 | 3 ms | 3 | 3 | SCHED_FIFO |
fifo3 | 3 ms | 2 | 4 | SCHED_FIFO |
package case_study3 public with Cheddar_Properties; thread a_task end a_task; thread implementation a_task.Periodic_Impl properties Dispatch_Protocol => Periodic; end a_task.Periodic_Impl; thread implementation a_task.Aperiodic_Impl properties Dispatch_Protocol => Aperiodic; end a_task.Aperiodic_Impl; process Application end Application; process implementation Application.Impl subcomponents other1 : thread a_task.Aperiodic_Impl; rr1 : thread a_task.Aperiodic_Impl; rr2 : thread a_task.Aperiodic_Impl; fifo1 : thread a_task.Aperiodic_Impl; fifo2 : thread a_task.Aperiodic_Impl; fifo3 : thread a_task.Aperiodic_Impl; properties Compute_Execution_Time => 1 ms .. 8 ms applies to other1; Priority => 0 applies to other1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_OTHERS applies to other1; Dispatch_Offset => 0 ms applies to other1; Compute_Execution_Time => 1 ms .. 5 ms applies to rr1; Priority => 3 applies to rr1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_RR applies to rr1; Dispatch_Offset => 2 ms applies to rr1; Compute_Execution_Time => 1 ms .. 5 ms applies to rr2; Priority => 3 applies to rr2; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_RR applies to rr2; Dispatch_Offset => 2 ms applies to rr2; Compute_Execution_Time => 1 ms .. 3 ms applies to fifo1; Priority => 4 applies to fifo1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_FIFO applies to fifo1; Dispatch_Offset => 3 ms applies to fifo1; Compute_Execution_Time => 1 ms .. 3 ms applies to fifo2; Priority => 3 applies to fifo2; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_FIFO applies to fifo2; Dispatch_Offset => 3 ms applies to fifo2; Compute_Execution_Time => 1 ms .. 3 ms applies to fifo3; Priority => 4 applies to fifo3; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_FIFO applies to fifo3; Dispatch_Offset => 2 ms applies to fifo3; end Application.Impl; processor cpu properties Scheduling_Protocol=>(POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL); end cpu; system root end root; system implementation root.Impl subcomponents process1 : process application.Impl; cpu1 : processor cpu; properties Actual_Processor_Binding => (reference (cpu1)) applies to process1; end root.Impl; end case_study3;
Threads | Worst case execution time | Release time | Priority | Policy |
---|---|---|---|---|
other1 | 5 ms | 5 ms | 0 | SCHED_OTHER |
rr1 | 3 ms | 3 ms | 7 | SCHED_RR |
rr2 | 3 ms | 4 ms | 7 | SCHED_RR |
fifo1 | 4 ms | 5 ms | 20 | SCHED_FIFO |
fifo2 | 2 ms | 4 ms | 5 | SCHED_FIFO |
package case_study4 public with Cheddar_Properties; thread a_task end a_task; thread implementation a_task.Periodic_Impl properties Dispatch_Protocol => Periodic; end a_task.Periodic_Impl; thread implementation a_task.Aperiodic_Impl properties Dispatch_Protocol => Aperiodic; end a_task.Aperiodic_Impl; process Application end Application; process implementation Application.Impl subcomponents T1 : thread a_task.Periodic_Impl; T2 : thread a_task.Periodic_Impl; other1 : thread a_task.Aperiodic_Impl; rr1 : thread a_task.Aperiodic_Impl; rr2 : thread a_task.Aperiodic_Impl; fifo1 : thread a_task.Aperiodic_Impl; fifo2 : thread a_task.Aperiodic_Impl; properties Compute_Execution_Time => 1 ms .. 5 ms applies to T1; Priority => 99 applies to T1; Period => 12 ms applies to T1; Deadline => 12 ms applies to T1; Compute_Execution_Time => 1 ms .. 2 ms applies to T2; Period => 6 ms applies to T2; Priority => 100 applies to T2; Deadline => 6 ms applies to T2; Compute_Execution_Time => 1 ms .. 5 ms applies to other1; Priority => 0 applies to other1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_OTHERS applies to other1; Dispatch_Offset => 5 ms applies to other1; Compute_Execution_Time => 1 ms .. 3 ms applies to rr1; Priority => 7 applies to rr1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_RR applies to rr1; Dispatch_Offset => 3 ms applies to rr1; Compute_Execution_Time => 1 ms .. 3 ms applies to rr2; Priority => 7 applies to rr2; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_RR applies to rr2; Dispatch_Offset => 4 ms applies to rr2; Compute_Execution_Time => 1 ms .. 4 ms applies to fifo1; Priority => 20 applies to fifo1; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_FIFO applies to fifo1; Dispatch_Offset => 5 ms applies to fifo1; Compute_Execution_Time => 1 ms .. 2 ms applies to fifo2; Priority => 5 applies to fifo2; Cheddar_Properties::POSIX_Scheduling_Policy => SCHED_FIFO applies to fifo2; Dispatch_Offset => 4 ms applies to fifo2; end Application.Impl; processor cpu properties Scheduling_Protocol=>(POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL); end cpu; system root end root; system implementation root.Impl subcomponents process1 : process application.Impl; cpu1 : processor cpu; properties Actual_Processor_Binding => (reference (cpu1)) applies to process1; end root.Impl; end case_study4;