Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the task priority correctly.
FreeRTOS
xTaskCreate(TaskFunction, "Task1", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting priority to 0 causes the task to have idle priority.
Using negative or out-of-range priorities causes errors.
✗ Incorrect
The task priority must be set above the idle priority to ensure it runs.
2fill in blank
mediumComplete the code to create a high priority task.
FreeRTOS
xTaskCreate(TaskFunction, "HighPriorityTask", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using configMAX_PRIORITIES causes invalid priority error.
Using idle priority for high priority tasks causes scheduling issues.
✗ Incorrect
High priority tasks use the highest valid priority, which is configMAX_PRIORITIES - 1.
3fill in blank
hardFix the error in the priority assignment.
FreeRTOS
vTaskPrioritySet(TaskHandle, [1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting priority to configMAX_PRIORITIES causes errors.
Negative priorities are invalid.
✗ Incorrect
Priority must be within valid range: 0 to configMAX_PRIORITIES - 1.
4fill in blank
hardFill both blanks to create a medium priority task and set its priority.
FreeRTOS
xTaskCreate(TaskFunction, "MediumTask", 1000, NULL, [1], &TaskHandle); vTaskPrioritySet(TaskHandle, [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different priorities for creation and setting causes confusion.
Using invalid priority values causes runtime errors.
✗ Incorrect
Both creation and priority set use the same valid medium priority.
5fill in blank
hardFill all three blanks to create a task, set its priority, and delete it properly.
FreeRTOS
xTaskCreate(TaskFunction, "TempTask", 1000, NULL, [1], &TaskHandle); vTaskPrioritySet(TaskHandle, [2]); vTaskDelete([3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Deleting task with NULL handle does nothing.
Using inconsistent priorities causes unexpected behavior.
✗ Incorrect
Create and set priority with valid value, then delete the task using its handle.