0

I work in the automotive embedded C programming domain and someone asked me what's the OS tasks system of my project (AUTOSAR). I am working in static analysis using Astree tool chain. I didn't have to create OS configuration for my project as it's generated by the other teams. So what is tasks in our embedded system? And how it work with thousands of C and H files in large Software? Is it referring to how we build the project? For example:

void task_OS_10ms_Task(void) {
    Rte_task_Cont_BswStart_10ms();
    FiM_MainFunction();
    DDRC_Proc_ArDebMainFunction_10ms();
    DFES_Proc_Data();
    ComCIL_Adapt_Proc_10ms();
    ComCIL_Co_Proc();
}
void task_OS_1ms_Task(void) {
    Rte_task_Cont_BswStart_1ms();
    Rte_task_Cont_BswEnd_1ms();
} // End of OS_1ms_Task

With above example, its mean 6 functions will be executed in total 10 ms or each one in 10 ms (total 60 ms)?

ahait
  • 27
  • 5
  • Technically, `10ms` is just part of the function name. You have to search you code base where those function names are used and check how the tasks are set up. A *guess* is that the first function is called every 10ms and the second once every ms. – Lindydancer Jan 15 '22 at 18:41
  • Tasks is likely just another name for processes. – Lundin Jan 17 '22 at 10:24
  • Your tasks seem to be one-shot, run-to-completion activations, as opposed to endless loops as in most other RTOSes (e.g., FreeRTOS). This is specific to automotive. You might want to google for "OSEK basic tasks" to learn more about them. – Miro Samek Feb 03 '22 at 16:07

2 Answers2

0

A Task is the smallest schedulable unit managed by the OS. It's equivalent to "Thread".

A Task is the object which executes (user) code and which is managed by the OS. E.g. the OS switches between different Tasks (“schedules”). There are 2 types of Tasks; for more details see [15]. Basic Task: A Task which can not block by itself. This means that it can not wait for (OS) event(s). Extended Task: A Task which can block by itself and wait for (OS) event(s). (Source: AUTOSAR_SWS_OS.pdf ver 4.2)

What you have inside a task are runnable entities or Main Processing Functions (Scheduled Functions) of BSW modules.

The 10ms that you have in the name of the task does not mean that this task will be executed every 10ms. The Period 10ms is part of Schedule Table which has to be defined in OS module. Keep in mind that AUTOSAR OS does not offer deadline monitoring for timing protection. This missing feature can be handled by WD stack.

In your example, All the functions has to be executed every 10ms. But sometimes we can map a runnanble (e.g 100ms) to a task 10ms, in this case the RTE will generate events/counters to be able to execute your runnable every 100ms.

Hob_io
  • 15
  • 4
0

The example you have here is simply talks about task enclosing some functions called cyclically. your task_os_10ms_task() is scheduled every 10ms by OS scheduler, and every function inside it also. Total execution time for the entire task would depend on what is your CPU frequency. It could be few ms or usecs but definitely not 60ms. Similarly, Your task_os_1ms_task() is going to be scheduled by os scheduler every 1ms. And, so are your RTE start and end function in it. Inside the task body it is simply a round robin execution. If your task is preemptive and a higher priority task is pending at then, os scheduler will. preempt your task and start the higher priority task. If not then, entire task is completed and control goes back to OS scheduler.

vpush
  • 11
  • 1