Bird
0
0

Which FreeRTOS queue size and block time settings are best to avoid data loss and ensure timely processing?

hard📝 Application Q8 of 15
FreeRTOS - Design Patterns for RTOS

You want to implement a producer-consumer system where the producer generates sensor data every 100ms and the consumer processes it. Which FreeRTOS queue size and block time settings are best to avoid data loss and ensure timely processing?

AQueue size 5, producer blocks indefinitely, consumer never blocks
BQueue size 1, producer never blocks, consumer blocks 100ms
CQueue size 10, producer blocks up to 100ms if full, consumer blocks indefinitely
DQueue size 0, producer and consumer never block
Step-by-Step Solution
Solution:
  1. Step 1: Determine queue size for buffering sensor data

    Queue size 10 allows buffering multiple data points to avoid loss if consumer is slow.
  2. Step 2: Set block times to balance producer and consumer

    Producer blocks up to 100ms to wait for space; consumer blocks indefinitely to wait for data.
  3. Final Answer:

    Queue size 10, producer blocks up to 100ms if full, consumer blocks indefinitely -> Option C
  4. Quick Check:

    Buffer size + blocking = no data loss [OK]
Quick Trick: Use enough queue size and blocking to prevent data loss [OK]
Common Mistakes:
  • Using queue size 0 (invalid)
  • Producer never blocking causes data loss
  • Consumer never blocking may miss data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes