2 Task Management Flashcards

1
Q

What is a task?

A

A task is a functioned block in the overall application. A task is like C void function. It has no return, it has an infinite loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the ready state

A

Ready: A task in ready state is a task that can execute however its waiting for a higher priority task before it can execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the running state

A

Running: A task that is currently executing. Only one task can be in the Running state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the suspended state

A

Suspended: A task can be suspended by vTaskSuspend API call and can be resumed by xTaskResume() API call.
It can only return to the ready state through xTaskResume()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the blocked state

A
  • Waiting for an external or temporal event.
  • Can be blocked waiting for a queue, semaphore.
  • Blocked task do not use any CPU resources.
  • vTaskDelay() function will block task.
  • Blocked state can have a timeout after which it will be unblocked and return to Ready State.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What API call would you use to start and stop a task?

A

vTaskSuspend() API call suspends a task.
xTaskResume() resumes a task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between suspended v blocked task states.

A

Suspended state: Uses CPU resources, xTaskResume() sets the state to ready, vTaskSuspend() sets the state to suspended.

Blocked state: Doesn’t use CPU resources, An external/ temporal event sets the state to ready, Can have a timeout after which it will return to the ready state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the range of task priorities?

A

The range is 0 to configMAX_PRIORITIES -1, where configMAX_PRIORITIES is set in FREERTOSConfig.h file.
If set to 7 the priority range is 0-6.
0 should ever be used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why should 0 priority not be used?

A

It is used for the idle task which runs when all other task are blocked or suspended.
Idle task frees up memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What API call would block a task?

A

vTaskDelay().
It takes in a tick time to block the task.
Using pdMS_TO_TICKS() we can set the amount of ms to delay the task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly