Bird
0
0

You want to design a FreeRTOS system where multiple tasks read sensor data but only one task writes it. Which design pattern ensures reliable multi-tasking here?

hard📝 Application Q8 of 15
FreeRTOS - Design Patterns for RTOS
You want to design a FreeRTOS system where multiple tasks read sensor data but only one task writes it. Which design pattern ensures reliable multi-tasking here?
AObserver pattern to notify tasks
BSingleton pattern for sensor data instance
CReader-Writer lock pattern using mutex and semaphore
DFactory pattern to create sensor tasks
Step-by-Step Solution
Solution:
  1. Step 1: Identify the problem type

    Multiple readers and single writer require controlled access to avoid conflicts.
  2. Step 2: Choose appropriate pattern

    Reader-Writer lock pattern allows concurrent reads but exclusive write access, ensuring reliability.
  3. Final Answer:

    Reader-Writer lock pattern using mutex and semaphore -> Option C
  4. Quick Check:

    Multiple readers, single writer = A [OK]
Quick Trick: Use reader-writer locks for shared read, exclusive write [OK]
Common Mistakes:
  • Using singleton for concurrency control
  • Confusing observer with locking
  • Thinking factory manages access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes