Bird
0
0

Identify the problem in this FreeRTOS code snippet:

medium📝 Debug Q14 of 15
FreeRTOS - Interrupt Management
Identify the problem in this FreeRTOS code snippet:
taskENTER_CRITICAL();
sharedCounter++;
// Missing taskEXIT_CRITICAL();
ANo problem, code is correct
BsharedCounter is not incremented
CSyntax error due to missing semicolon
DInterrupts remain disabled causing system issues
Step-by-Step Solution
Solution:
  1. Step 1: Check for matching critical section calls

    The code calls taskENTER_CRITICAL() but does not call taskEXIT_CRITICAL() to re-enable interrupts.
  2. Step 2: Understand consequences of missing exit

    Interrupts remain disabled indefinitely, which can cause system to freeze or miss important events.
  3. Final Answer:

    Interrupts remain disabled causing system issues -> Option D
  4. Quick Check:

    Missing taskEXIT_CRITICAL() disables interrupts forever = A [OK]
Quick Trick: Always pair taskENTER_CRITICAL() with taskEXIT_CRITICAL() [OK]
Common Mistakes:
  • Ignoring missing exit call
  • Assuming increment fails
  • Thinking code has syntax errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes