What do race conditions, corrupt data, and missed real-time deadlines all have in common? Well, for one, they are all mistakes that can be easily made when operations are performed in parallel. These are also mistakes that are avoidable (in part) through using the right tools.
This chapter covers many of the mechanisms that are used to synchronize tasks and protect shared data. All the explanations in this chapter will contain example code and analysis that will have been performed using Ozone and SystemView.
First, we will explore the differences between semaphores and mutexes. Then, you will understand how, when, and why to use a semaphore. You'll also learn about race conditions and see how a mutex can avoid such situations. Example code will be provided throughout. The concept of race conditions will be introduced and fixed using...