@@ -184,8 +184,8 @@ Queuing of topics:
184
184
* Queue enable and queue length are "runtime static" configuration settings
185
185
186
186
187
- Process/Thread Mapping
188
- ======================
187
+ Process/Thread/Activity Mapping
188
+ ===============================
189
189
190
190
* An application consists of one or more processes
191
191
* One of the processes is the primary process
@@ -208,6 +208,50 @@ Process/Thread Mapping
208
208
achieve Freedom From Interference for safety relevant applications
209
209
210
210
211
+ Static mapping of activities to threads
212
+ '''''''''''''''''''''''''''''''''''''''
213
+
214
+ As pointed out above, FEO activities are required to be mapped to threads in a static way.
215
+ The rationale behind this requirement is:
216
+
217
+ * Calling activity functions init(), step() and shutdown() from a single pre-defined thread
218
+ allows implementations to make use of thread-local optimizations such as thread-local variables.
219
+ * Calling an activity's step() function from different threads in different iterations of the
220
+ task chain may cause execution time jitter e.g. from unpredictable cache misses or different
221
+ properties of the processor cores the respective threads may be assigned to.
222
+ * Most importantly, a dynamic assignment of activities to threads may result in non-deterministic
223
+ variations of the task-chain execution time.
224
+
225
+ To understand how a dynamic thread assignment can cause execution time variations, consider
226
+ the following example (sub-) task chain.
227
+
228
+ |example_task_chain |
229
+
230
+ Here, activity 6 depends on, i.e. must be executed after activities 1 to 5. The length of the bars
231
+ is intended to indicate the relative computation time needed by the respective activity on a
232
+ single processor core. It is assumed that all of these activities will be executed in the same process.
233
+
234
+ In a simple approach, each of the activities 1 to 5 could be assigned to its own thread and
235
+ activity 6 could be executed subsequently in one of these threads as shown in the figure below.
236
+ Each blue "lane" indicates one thread.
237
+
238
+ |example_task_chain_5_threads |
239
+
240
+ If each thread runs on a separate core and execution is not interrupted by other tasks, the length of
241
+ the blue box is related to the total execution time of the task chain.
242
+
243
+ Approximately the same total execution time can be achieved with only 3 threads (on three cores), if the
244
+ tasks are assigned in an optimized way:
245
+
246
+ |example_task_chain_3_threads_optimized |
247
+
248
+ If, on the other hand, activities are assigned to the same 3 threads in a dynamic way, the execution
249
+ time may vary unpredictably, because of the possibly varying execution sequence of activities,
250
+ as can be seen below.
251
+
252
+ |example_task_chain_3_threads_dynamic |
253
+
254
+
211
255
Lifecycle
212
256
=========
213
257
@@ -383,3 +427,11 @@ timing of activities, supporting safety-critical applications
383
427
in the automotive domain. In this domain the footprint of the framework is curcial especially
384
428
w.r.t impact of computation load and latency.
385
429
430
+
431
+ .. |example_task_chain | image :: _assets/example_task_chain.png
432
+
433
+ .. |example_task_chain_5_threads | image :: _assets/example_task_chain_5_threads.png
434
+
435
+ .. |example_task_chain_3_threads_optimized | image :: _assets/example_task_chain_3_threads_optimized.png
436
+
437
+ .. |example_task_chain_3_threads_dynamic | image :: _assets/example_task_chain_3_threads_dynamic.png
0 commit comments