Synchronization blues

Synchronization is hard in real-time applications, but not as hard as people imagine. If you follow a few simple rules you can make it manageable.

  1. Never force priority and mutual exclusion to fight each other. You can’t mean “Task A is more important than TaskB” and “TaskB should be able to lock TaskA out of some data structure as long as it want” at the same time.
  2. Long critical sections are sure signals of bad design. Use a simpler data structure or a client/server architecture or something.
  3. Stick to two or three mechanisms. If semaphores and RT-Fifos don’t do the trick, then maybe you should simplify your design.

See my paper for more details.