This paper discusses how to divide your code into a set of tasks under a Real-Time Operating System (RTOS) by illustrating a few design patterns to help you in that effort, patterns that have turned up repeatedly in our design work. The patterns we’ll discuss fall into three major groups: desynchronizing patterns, synchronizing patterns, and architectural patterns. In addition, we’ll consider how best to write the code for a task in order to avoid many of the common pitfalls of multi-threaded programming.