Home | Projects | Notes > Real-Time Operating Systems (RTOS) > Tasks

Tasks

 

Application and Task

 

Different Types of Tasks

  1. Continuous task - Runs continuously on the CPU.

  2. Periodic task - Runs on the CPU with a fixed execution period.

  3. Aperiodic task - Runs on the CPU when a certain event occurs. (e.g., Keypad interfacing)

 

Two Steps of Creating a Task in FreeRTOS

  1. Create a task

    This step is creating a task in memory, which involves allocating memory for the Task Control Block (TCB).

  2. Implement the task (i.e., Create task handler)

    This is a piece of code that will run on the CPU.

    iVariableExample is a local variable, which will be created in the stack space of this task. If this task handler is used by multiple tasks, then iVariableExample will be created in each task's own stack.

    If iVariableExample were declared as a static variable, it would've been a global (shared) variable among those tasks that use this task handler.

Notes

 

FreeRTOS Task Creation API

 

Task Priorities

 

Exercise

 

FreeRTOS Task Creation Behind the Scenes

 

freertos-task-creation-memory-usage

 

 

Idle Task

 

idle-task

 

 

Timer Services Task (Timer_svc)

 

Review Questions

 

 

References

Nayak, K. (2022). Mastering RTOS: Hands on FreeRTOS and STM32Fx with Debugging [Video file]. Retrieved from https://www.udemy.com/course/mastering-rtos-hands-on-with-freertos-arduino-and-stm32fx/