0
0
FreeRTOSprogramming~10 mins

Task states (Ready, Running, Blocked, Suspended) in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a task state to Ready.

FreeRTOS
eTaskState state = [1];
Drag options to blanks, or click blank then click option'
AeRunning
BeReady
CeBlocked
DeSuspended
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Running instead of Ready, which means the task is currently executing.
2fill in blank
medium

Complete the code to check if a task is currently Running.

FreeRTOS
if (eTaskGetState(taskHandle) == [1]) {
    // Task is running
}
Drag options to blanks, or click blank then click option'
AeReady
BeBlocked
CeRunning
DeSuspended
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing Ready with Running state.
3fill in blank
hard

Fix the error in the code to correctly set a task to Blocked state.

FreeRTOS
vTaskDelay([1]); // Delay causes task to enter Blocked state
Drag options to blanks, or click blank then click option'
A100
BportMAX_DELAY
C0
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero or negative values which do not block the task.
4fill in blank
hard

Fill both blanks to create a task and then suspend it.

FreeRTOS
xTaskCreate(taskFunction, "Task", 1000, NULL, 1, &taskHandle);
vTask[1](taskHandle); // Suspend the task
// Later
vTask[2](taskHandle); // Resume the task
Drag options to blanks, or click blank then click option'
ASuspend
BResume
CDelete
DStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using Delete instead of Suspend, which removes the task permanently.
5fill in blank
hard

Fill all three blanks to create a dictionary of task states for given tasks.

FreeRTOS
eTaskState states[] = {
    [1],
    [2],
    [3]
};
Drag options to blanks, or click blank then click option'
AeReady
BeRunning
CeBlocked
DeSuspended
Attempts:
3 left
💡 Hint
Common Mistakes
Repeating the same state multiple times.