RealTime programming is a bit of a BlackArt. Compared to other types of programming, there are relatively few authoritative texts and few college programming courses available that describe the common patterns for solving problems such as these:
Click on this page's title for a list of all pages in this category.
DougSchmidt and his team have described several patterns for concurrent, parallel, and distributed systems, many of which are designed to also address real-time constraints: http://www.cs.wustl.edu/~schmidt/patterns-ace.html
See "Patterns for Time-Triggered Embedded Systems" by Michael J. Pont. ISBN 0201331381
This book uses pattern form to explain how to build controllers for things like microwave ovens and clocks. The computers for these devices are very small, with a few hundred bytes of RAM. It is a fascinating book! -- RalphJohnson