University of Ottawa
SEG 4145 Software Engineering - Quiz 5
Participation Review: RTOS Synchronization
Mechanisms - Mutexes, Semaphores, Queues,
and Priority Inversion
Course: SEG 4145
, Quiz5
Q0. Mutexes and Priority Inheritance 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 M is automatically suspended by the scheduler
B. Task L's priority is temporarily increased to match Task H's priority
C. Task H performs "busy-waiting" until the mutex is released
D. The mutex is forcibly taken from Task L and given to Task H
Correct answer: B
Q1. Counting Semaphores vs Binary Semaphores
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 binary semaphore initialized to 1
B. A mutex with priority inheritance
C. A counting semaphore initialized to 3
D. A queue with a length of 1
Correct answer: C
Q2. Queue Blocking and Scheduling
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 consumes CPU cycles in a busy-wait loop for 100 ticks.
B. Task A is placed into the Blocked state, and Task B immediately resumes execution.
C. The system generates a stack overflow error because the queue is empty.
D. Task A forces Task B to immediately write data into the queue.
Correct answer: B