Chapter 4 Flashcards

(14 cards)

1
Q

In a scenario with three tasks—High (H), Medium (M), and Low (L)—task L holds a mutex that task H is waiting for. If task M becomes ready to run, what mechanism ensures that task H is not delayed indefinitely by task M?

A

Task L’s priority is temporarily increased to match Task H’s priority

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

An application must manage access to a pool of three identical printers shared among multiple tasks. Which mechanism is the most appropriate to track resource availability and
prevent tasks from attempting to access a printer that is already in use?

A

A counting semaphore initialized to 3

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

Task A (high priority) attempts to read data from an empty queue using an xTicksToWait value of 100. Task B (low priority) is currently running. What happens at the exact moment
Task A calls the receive function?

A

Task A is placed into the Blocked state, and Task B immediately resumes execution.

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

A low-priority task sends an item to a queue. A higher-priority task is blocked waiting on that queue. When does a context switch occur?

A

Immediately after the send

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

A task calls xQueueSend() on a full queue using a non-zero timeout. What is the correct behavior?

A

The task is blocked

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

What happens when xQueueReceive() is called on an empty queue with a specified timeout?

A

The task is blocked

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

Which property of an RTOS queue is independent of task priority?

A

Order of stored items

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

What does the maximum count of a counting semaphore represent?

A

Number of available resources.

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

If a task fails to take a counting semaphore before the timeout expires, what must it do?

A

Handle the failure

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

Why is a binary semaphore not ideal for protecting complex critical sections?

A

It lacks priority inheritance.

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

Which condition is required for priority inversion to occur?

A

A blocking shared resource exists

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

Which mechanism allows a mutex to reduce the impact of priority inversion?

A

Priority inheritance

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

What happens after a task releases a mutex that caused priority inheritance?

A

Its priority is restored

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

Scenario:
Task 1 (high priority) is blocked because it is attempting to send data to a full queue. Task 2 (low priority) is currently running and removes an item from the same queue, thereby freeing space.

Question:
According to the scheduling mechanisms presented, which event occurs immediately after Task 2 calls the queue receive function?

A

Task 1 is unblocked by the scheduler and immediately preempts Task 2 to fill the freed space in the queue.

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