Bird
0
0

What is the expected behavior of xSemaphoreGiveFromISR() when called inside an ISR and the semaphore unblocks a higher priority task?

medium📝 Predict Output Q5 of 15
FreeRTOS - Interrupt Management
What is the expected behavior of xSemaphoreGiveFromISR() when called inside an ISR and the semaphore unblocks a higher priority task?
AIt sets the <code>higherPriorityTaskWoken</code> flag to pdTRUE
BIt blocks the ISR until the task runs
CIt disables all interrupts until the task finishes
DIt returns an error code
Step-by-Step Solution
Solution:
  1. Step 1: Understand xSemaphoreGiveFromISR() role

    This function releases a semaphore from ISR and can unblock a waiting task.
  2. Step 2: Check flag behavior when unblocking higher priority task

    If a higher priority task is unblocked, the function sets higherPriorityTaskWoken to pdTRUE to indicate a context switch may be needed.
  3. Final Answer:

    It sets the higherPriorityTaskWoken flag to pdTRUE -> Option A
  4. Quick Check:

    Semaphore give from ISR sets wake flag = pdTRUE [OK]
Quick Trick: FromISR semaphore give sets wake flag if task unblocked [OK]
Common Mistakes:
  • Thinking ISR blocks until task runs
  • Assuming interrupts are disabled globally
  • Expecting error return on success

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes