Semaphores
We’ve mentioned several times now that tasks are meant to be programmed so that they’re running in parallel. This means that, by default, they have no relation to one another in time. No assumptions can be made as to where tasks are in their execution with respect to one another – unless they are explicitly synchronized. Semaphores are one mechanism that’s used to provide synchronization between tasks.
Semaphores are presented in the following two sections. The first section describes semaphores conceptually. The second section shows how to use FreeRTOS’s semaphores, via example-programs.
Understanding semaphores
Semaphores are a very straightforward, but powerful, construct. The word semaphore has a Greek origin – the approximate English translation is sign-bearer, which is a wonderfully intuitive way to think about them. Semaphores are used to indicate that something has happened – they signal events. Some example...