Changes between Initial Version and Version 1 of RtTaskProposal


Ignore:
Timestamp:
Aug 23, 2009, 4:54:15 PM (15 years ago)
Author:
Nicolas Pouillon
Comment:

RFC

Legend:

Unmodified
Added
Removed
Modified
  • RtTaskProposal

    v1 v1  
     1
     2= Adding a Real-Time task model =
     3
     4== Purpose ==
     5
     6This document details an improvement of the DSX task modeling API in order to add real-time capabilities.
     7
     8== Real-Time Task features ==
     9
     10Real-time tasks have:
     11 * No implicit permanent existance (they are not repeated infinitely)
     12 * Possibility to receive asynchronous signals from:
     13  * Other Real-time tasks
     14  * "normal" tasks
     15  * External interrupt lines
     16  * Programmable timers
     17 * An user-defined set of slots (receivers for signals)
     18 * one "main" behaviour function
     19 * an internal state
     20
     21== Restrictions ==
     22
     23Having code called asynchronously from slots implies the task's slot could interrupt "main" behaviour function. Therefore:
     24 * slots are executed in a separate limited stack space, no heavy computation should be done in them.
     25 * as main behaviour function may be already communicating on ports, the only permitted operations on ports are reset, see below.
     26 * if any port is touched (reset) from a slot, task must be resetted too (see `srl_task_*()` below).
     27
     28== Description API Evolution ==
     29
     30Let's introduce three new objects in DSX description language:
     31 * !SignalPort,
     32 * !SlotPort,
     33 * !RtTaskModel
     34 * !Signal
     35
     36=== New Port Types ===
     37
     38==== Signal ====
     39
     40A !SignalPort port is an '''output''' for an event propagation. It has no parameter:
     41
     42{{{
     43    ...
     44    ports = {...
     45             'finished_processing' : SignalPort(),
     46             },
     47    ...
     48}}}
     49
     50==== Slot ====
     51
     52A !SlotPort is an '''input''' for an event propagation. It has no parameter:
     53
     54{{{
     55    ...
     56    ports = {...
     57             'on_finish_processing' : SlotPort(),
     58             },
     59    ...
     60}}}
     61
     62=== Enhancement of the current !TaskModel ===
     63
     64It is now possible to declare `SignalPort`s for a !TakModel.
     65
     66=== New !RtTaskModel ===
     67
     68It looks like a !TaskModel object, but its ports may contain Slot and Signal ports:
     69
     70{{{
     71RtTaskModel("processing_monitor",
     72             ports = {
     73                      'on_begin_processing': SlotPort(),
     74                      'on_finish_processing': SlotPort(),
     75                      'on_application_reset': SlotPort(),
     76                      },
     77}}}
     78
     79Implementations are listed as usual.
     80As it requires a good amount of supporting code, for now, the only valid implementation for a Real-time task will be software.
     81
     82{{{
     83             impls = [
     84                 SwTask('main_behaviour',
     85                        stack_size = 4096,
     86                        bootstrap = 'optional_bootstrap_func',
     87                        sources = ['path/to/source.c'],
     88}}}
     89
     90Now we have to list the Real-time tasks specific attributes:
     91 * The internal state data C type
     92 * The slots functions available
     93 * An optional mapping of some slots to slots functions.
     94   By default, mapping is done by a name identity (here `on_application_reset` will implicitely be routed to the `on_application_reset` function),
     95   but this permits to route many slots to one function.
     96
     97{{{
     98                        state_type = 'struct process_monitor_state_s',
     99                        slot_funcs = ['something_happened', 'on_application_reset'],
     100                        slot_map = {'on_begin_processing': 'something_happened',
     101                                    'on_finish_processing': 'something_happened',
     102                                    },
     103                     ),
     104                 ],
     105             )
     106}}}
     107
     108=== Tcg evolution ===
     109
     110Now the Tcg has to connect signals to slots.
     111
     112Connection is done through a `Signal` object, assigned during the portmap.
     113
     114The following restrictions must be respected:
     115 * A signal must be connected to at least one `SignalPort`
     116 * A signal may be connected to at least zero `SlotPort`
     117 * A `SlotPort` may be left unconnected, and may be connected to one `Signal`
     118 * A `SignalPort` must be connected to exactly one `Signal`
     119
     120=== Mapping ===
     121
     122Mapping of `Signal` resources on `MutekS` or `MutekH` needs:
     123 * a `desc` in (possibly) read-only memory
     124
     125== SRL API evolution ==
     126
     127=== !SignalPort-related ===
     128
     129There is a new abstract type: `srl_signal_t`. The only thing permitted on a !SignalPort is to emit the signal, therefore, the only function available for it is `srl_signal_emit()`.
     130
     131{{{
     132FUNC(processor)
     133{
     134    srl_signal_t finished_processing = GET_ARG(finished_processing);
     135
     136
     137    ...
     138
     139    srl_signal_emit(finished_processing);
     140}
     141}}}
     142
     143=== !SlotPort-related ===
     144
     145There is nothing publicly available to deal with slots from the software point of view, !SlotPorts are not even exposed to GET_ARG().
     146
     147=== Task Management Related ===
     148
     149There are now ways to tell the "main" function to start or stop. As this function is the only one, it is implicit in the API. It can't be started more than once. The two available functions are:
     150
     151 * {{{srl_task_launch();}}}
     152 * {{{srl_task_terminate();}}}
     153
     154If the task is already running, {{{srl_task_launch()}}} has no effect.
     155If the task is not currently is running, {{{srl_task_terminate()}}} has no effect.
     156
     157Terminating a task means it will be interrupted whatever it is doing, even if it has taken a lock or is operating on a communication channel. That means you '''MUST''' reset '''all''' resources (ports) when resetting a task.
     158
     159In order to restart a task, simply `terminate()` and `lauch()` it.
     160
     161=== Reset operations for existing communication channels ===
     162
     163We introduce the following new calls:
     164
     165 * `srl_mwmr_reset( srl_mwmr_t channel )`
     166 * `srl_lock_reset( srl_lock_t lock )`
     167 * `srl_barrier_reset( srl_barrier_t barrier )`
     168
     169Those calls don't abide current locking state of the resources and resets their locks to an "free" status. Concurrent tasks using the same resources may reach an undefined state. These tasks should be reset too.