Synchronization between Tasks
A real-time system is essentially a multitasking system and task synchronization is essential for the tasks to share common resources like memory buffers and I/O devices or for sequencing of tasks when there exists a specific precedence or dependency relationship. An RTOS normally provides two types of synchronization: explicit synchronization and implicit synchronization.
Explicit synchronization is a type of synchronization in which the task IDs are known to the synchronized task entities. The synchronization is achieved using a technique called cross stimulation. Figure 1.9 illustrates explicit synchronization.
The advantage of this kind of synchronization is the speed. The task IDs need to be known to all the participating tasks and this is usually done by an initialization task. However, Figure 1.9 has been specifically chosen to represent explicit synchronization to bring out a case where this should not be used. In Figure 1.9 the task T periodically stimulates task T2 and thus there exists a strong cohesion between the two tasks, and since T2 succeeds
T1 a contention for shared resources shall never arise in case the tasks constitute a producer-consumer pair. On the contrary, if T1 is a timer process that generates a periodic wakeup for T2, then this makes sense. Thus explicit synchronization is more useful for precise task sequencing rather than managing sharing of resources.