Gridlock
A data acquisition system has three FreeRTOS tasks at different priorities sharing a sensor buffer. The high-priority task reads the buffer, the low-priority task updates it, and a medium-priority task does independent processing. The high and low tasks protect the buffer with a semaphore.
Something is wrong with the scheduling. When the high-priority task tries to access the shared buffer while the low-priority task holds the lock, the medium-priority task runs first, starving the high-priority task. The output comes out in the wrong order.
Each task prints its name (LOW, HIGH, MED) on its own line when its work completes, with DONE last. In the correct order, the low task's line comes first (it holds the lock when the run starts), the high task's line follows as soon as the lock releases, and the medium task's line only after the high-priority work is done.
The starter code compiles and runs, but the task execution order is wrong. Find and fix the bug.