0
0
FreeRTOSprogramming~5 mins

Task priority assignment in FreeRTOS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is task priority in FreeRTOS?
Task priority is a number that tells FreeRTOS which task is more important. Higher priority tasks run before lower priority ones.
Click to reveal answer
beginner
How do you assign a priority to a task when creating it in FreeRTOS?
You assign priority by passing a number as the 'uxPriority' parameter in the xTaskCreate() function.
Click to reveal answer
intermediate
What happens if two tasks have the same priority in FreeRTOS?
If two tasks have the same priority, FreeRTOS switches between them in a round-robin way, sharing CPU time fairly.
Click to reveal answer
intermediate
Can task priority be changed after a task is created? How?
Yes, you can change a task's priority anytime using the vTaskPrioritySet() function.
Click to reveal answer
advanced
Why should you avoid giving all tasks the same high priority?
Giving all tasks the same high priority can cause poor system performance because tasks will compete and may starve lower priority tasks.
Click to reveal answer
In FreeRTOS, which task will run first?
AThe task with the highest priority number
BThe task created first
CThe task with the lowest priority number
DThe task with the longest name
How do you set the priority of a task when creating it?
ABy passing the priority as a parameter to xTaskCreate()
BBy calling vTaskPrioritySet() before creating the task
CBy naming the task with a priority number
DBy setting a global variable
What does FreeRTOS do if two tasks have the same priority?
ARuns the task with the lower priority
BRuns them one after the other in round-robin fashion
CRuns the task with the longer name
DRuns only the first created task
Which function changes a task's priority after creation?
AxTaskCreate()
BvTaskDelete()
CvTaskPrioritySet()
DxTaskResume()
Why is it bad to give all tasks the same high priority?
AIt saves memory
BIt makes the system run faster
CIt disables task switching
DIt can cause tasks to compete and starve others
Explain how task priority affects task scheduling in FreeRTOS.
Think about which tasks get CPU time first and how tasks with same priority share time.
You got /3 concepts.
    Describe how to assign and change task priority in FreeRTOS.
    Consider both when creating a task and after it is running.
    You got /3 concepts.