cancel
Showing results for 
Search instead for 
Did you mean: 

In FreeRTOS, priority settings

Kai_Satone
Associate III

Hello everyone,

I am using FreeRTOS but i am confuse about seting priority, Should I give same priority to every task or different priority to all task.

And also what is different between them.

1 ACCEPTED SOLUTION

Accepted Solutions
nouirakh
ST Employee

Hello @Kai_Satone 

In FreeRTOS, task priority is a crucial aspect of managing how tasks are scheduled and executed. It is not generally advisable to give every task the same priority, priorities should be assigned based on the importance and time sensitivity of each task. Higher priority tasks will preempt lower priority tasks, ensuring that the most critical operations are attended to promptly. If all tasks have the same priority, they will typically be scheduled round-robin. This means each task gets an equal share of CPU time, which might not be optimal for time-sensitive tasks.
Here are a few things to think about when it comes to setting task priorities:
Criticality of the task: High-priority tasks are often the ones that have to respond quickly to events or manage time-sensitive operations.
Real-time Requirements: Real-time systems may require tasks to be completed within certain time constraints, dictating higher priorities for those tasks.
Execution time of the task: Tasks that take longer may be given a lower priority to ensure they do not block fast tasks.

In conclusion, Think carefully about which tasks are most important. This helps the system respond quickly and manage scheduling complexity.

View solution in original post

2 REPLIES 2
nouirakh
ST Employee

Hello @Kai_Satone 

In FreeRTOS, task priority is a crucial aspect of managing how tasks are scheduled and executed. It is not generally advisable to give every task the same priority, priorities should be assigned based on the importance and time sensitivity of each task. Higher priority tasks will preempt lower priority tasks, ensuring that the most critical operations are attended to promptly. If all tasks have the same priority, they will typically be scheduled round-robin. This means each task gets an equal share of CPU time, which might not be optimal for time-sensitive tasks.
Here are a few things to think about when it comes to setting task priorities:
Criticality of the task: High-priority tasks are often the ones that have to respond quickly to events or manage time-sensitive operations.
Real-time Requirements: Real-time systems may require tasks to be completed within certain time constraints, dictating higher priorities for those tasks.
Execution time of the task: Tasks that take longer may be given a lower priority to ensure they do not block fast tasks.

In conclusion, Think carefully about which tasks are most important. This helps the system respond quickly and manage scheduling complexity.