2024-05-29 02:23 AM
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.
Solved! Go to Solution.
2024-05-29 06:52 AM
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.
2024-05-29 02:26 AM - edited 2024-05-29 02:27 AM
This is a general FreeRTOS thing - nothing specifically to do with ST or STM32:
https://www.freertos.org/RTOS-task-priority.html
2024-05-29 06:52 AM
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.