Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Priority value in FreeRTOS xTaskCreate() method

Tags:

c

api

freertos

I can not seem to find what a priority value passed to task creation functions of FreeRTOS mean. If I remember correctly ThreadX uses smaller values for higher priorities i.e task with priority value 1 has higher priority value than task with priority value 2. But for FreeRTOS I cant seem to find whether if it is the same or if it is the opposite i.e higher value meaning higher priority.

I have tried googling but couldn't find anything. FreeRTOS API reference page for xTaskCreate only specifies that this is the priority value. Can some one please help resolve this confusion.

like image 324
binW Avatar asked Jan 08 '14 22:01

binW


People also ask

What is the highest priority in FreeRTOS?

The FreeRTOS scheduler ensures that tasks in the Ready or Running state will always be given processor (CPU) time in preference to tasks of a lower priority that are also in the ready state. In other words, the task placed into the Running state is always the highest priority task that is able to run.

How do I change priority of a FreeRTOS task?

by using the vTaskPrioritySet() API function to change the priority of two tasks relative to each other.

What is priority inversion in FreeRTOS?

Priority inversion is a bug that occurs when a high priority task is indirectly preempted by a low priority task. For example, the low priority task holds a mutex that the high priority task must wait for to continue executing.

Which task is created automatically by the first call to xTaskCreate ()?

xTaskCreate() can only be used to create a task that has unrestricted access to the entire microcontroller memory map. Systems that include MPU support can alternatively create an MPU constrained task using xTaskCreateRestricted().


1 Answers

Found answer to my question in FreeRTOS Quick start guide. The section on task priorities explains that lower priority numbers denote lower priority tasks and idle task has priority zero which is the lowest priority.

like image 74
binW Avatar answered Oct 12 '22 08:10

binW