Previous: Thread components mapping, Up: Components mapping rules


7.1.4 Process components mapping

The main component in this phase is the process component. The distributed application is a set of processes which communicate between each other. Each process is mapped to an Ada95 main subprogram which leads to an executable after being compiled.

7.1.4.1 Shared variables declaration and initialization

In the case where a process contains shared variables declaration (which should always refers to local data components, as Gaia does not support variables shared amongst multiples process), a variable is declared in the proc_servant body package.

If the shared variable has a protected access property, Gaia will also add a initialize procedure to the package, and set it as the package initialization procedure for the middleware, which will ensure that it is ran before any usage of the package. This procedure calls protected type's Build interface (cf. Data components mapping), initializing middleware's mutexes.

Note that shared variables (either protected or not) are visible from any thread of the process. How those variables are accessed and updated is described in Thread components mapping.

Here is a AADL specification for declaring a data shared between two threads, with protected access in a process:

     
     --  protected data type declaration
     
     data internal_data
     properties
       ARAO::data_type => integer;
     end internal_data;
     
     data shared_data
     properties
       Concurrency_Control_Protocol => Protected_Access;
     end shared_data;
     
     data implementation shared_data.i
     subcomponents
       Field : data internal_data;
     end shared_data.i;
     
     --  Process declaration
     
     process transmitter_node
     features
       msg_in : in event data port message;
       msg_out : out event data port message;
     end transmitter_node;
     
     process implementation transmitter_node.complex
     subcomponents
       th1 : thread transmitter.simple;
       th2 : thread transmitter.simple;
       sh_mem : data shared_data.i;
     connections
       event data port msg_in -> th1.msg_in;
       event data port th1.msg_out -> th2.msg_in;
       event data port th2.msg_out -> msg_out;
       data access sh_mem -> th1.mem;
       data access sh_mem -> th2.mem;
     end transmitter_node.complex;

and here is the related code generated by Gaia :

     
     package body Tr_Servants is
     
        --  Shared variable declaration
     
        Sh_Mem : Partition.Shared_Data_I;
     
        --  Initialization procedure declaration and description
     
        procedure Initialize;
     
        ----------------
        -- Initialize --
        ----------------
     
        procedure Initialize is
        begin
           Partition.Builder
             (Sh_Mem);
        end Initialize;
     
        --  Threads-related code
        --  (...)
     
        --  Bind initialization function with middleware initialization
     begin
        declare
           use PolyORB.Utils.Strings;
           use PolyORB.Utils.Strings.Lists;
        begin
           PolyORB.Initialization.Register_Module
             (PolyORB.Initialization.Module_Info'
              (Name => + "tr_Servants",
               Conflicts => PolyORB.Utils.Strings.Lists.Empty,
               Depends => + "any",
               Provides => PolyORB.Utils.Strings.Lists.Empty,
               Implicit => False,
               Init => Initialize'Access,
               Shutdown => null));
        end;
     end Tr_Servants;
     
7.1.4.2 AADL Properties support

Available properties for process components can be found in SAE AS5506, in 5.5 page 77 and in Appendix A, pages 197-218.

Active_Thread_Handling_Protocol Not Supported
Active_Thread_Queue_Handling_Protocol Not Supported
Actual_Connection_Binding Not Supported
Actual_Memory_Binding Not Supported
Actual_Processor_Binding Supported
Allowed_Connection_Protocol Not Supported
Deadline Not Supported
Load_Deadline Not Supported
Load_Time Not Supported
Not_Collocated Not Supported
Period Not Supported
Runtime_Protection Not Supported
Server_Subprogram_Call_Binding Not Supported
Source_Code_Size Not Supported
Source_Data_Size Not Supported
Source_Stack_Size Supported
Source_Name Not Supported
Source_Text Not Supported
Source_Language Not Supported
Synchronized_Component Not Supported