
h3(#user-sw-runtime). Software (runtime)

During runtime, the dynamic behavior of the software can be observed. The following Gantt chart shows an excerpt of such a dynamic behavior.

!{width: 1000px}../pictures/user_sw_runtime_gantt.png!

To model the observed behavior in the AMALTHEA model there are schedulable units (Processes) that contain the basic software units (Runnables) and stimuli that describe when the processes are executed. Statistical elements like distributions (Gauss, Weibull, ...) are also available in the model. They allow describing the variation of values if there are multiple occurrences.  

In the following sections, a high level description of the individual elements of a software description that define the dynamic behavior are presented.


h4. Processes (Tasks or ISRs)

!{width: 1000px}../pictures/user_sw_runtime_gantt_task.png!

Processes represent executable units that are managed by an operating system scheduler. A process is thus the smallest schedulable unit managed by the operating system. Each process also has its own name space and resources (including memory) protected against use from other processes. In general, two different kinds of processes can be distinguished: task and Interrupt Service Routine (ISR). Latter is a software routine called in case of an interrupt. ISRs have normally higher priority than tasks and can only be suspended by another ISR which presents a higher priority than the one running. In the Gantt chart above, a task called 'TASK_InputProcessing' can be seen. All elements that run within the context of a process are described in the following sections.

h5. Runnables

!{width: 1000px}../pictures/user_sw_runtime_gantt_runnable.png!

Runnables are basic software units. In general it can be said that a Runnable is comparable to a function. It runs within the context of a process and is described by a sequence of instructions. Those instructions can again represent different actions that define the dynamic behavior of the software. Following, such possible actions are listed:
* Semaphore Access: request/release of a semaphore
* Label Access: reading/writing a data signal
* Ticks: number of ticks (cycles) to be executed
* ...

!../pictures/user_sw_new_runnable_item.png!

In the following sections elements, that can be of concern within a runnable, are described in more detail.

h5. Labels

!{width: 1000px}../pictures/user_sw_runtime_gantt_signal.png!

Labels represent the system's view of data exchange. As a consequence, labels are used to represent communication in a flattened structure, with (at least) one label defined for each data element sent or received by a Runnable instance.

h5. Semaphore

!{width: 1000px}../pictures/user_sw_runtime_gantt_semaphore.png!

The main functionality of a semaphore is to control simultaneous use of a single resource by several entities, e.g. scheduling of requests, multiple access protection.


h4. Stimulation

Before, we described the dynamic behavior of a specific process instance. In general however, a process is not only activated once but many times. The action of activating a process is called stimulation. The following stimulation patterns are typically used for specification:
* Single: single activation of a process
* Periodic: periodic activation of a process with a specific frequency
* VariableRate: periodic activations based on other events, like rotation speed
* Event: activation triggered by a __TriggerEvent__
* InterProcess: activations based on an explicit inter-process trigger

!../pictures/model__stimuli.png!
