Книга: Real-Time Concepts for Embedded Systems
7.7.2 Interlocked, One-Way Data Communication
7.7.2 Interlocked, One-Way Data Communication
In some designs, a sending task might require a handshake (acknowledgement) that the receiving task has been successful in receiving the message. This process is called interlocked communication, in which the sending task sends a message and waits to see if the message is received.
This requirement can be useful for reliable communications or task synchronization. For example, if the message for some reason is not received correctly, the sending task can resend it. Using interlocked communication can close a synchronization loop. To do so, you can construct a continuous loop in which sending and receiving tasks operate in lockstep with each other. An example of one-way, interlocked data communication is illustrated in Figure 7.7.
Figure 7.7: Interlocked, one-way data communication.
In this case, tSourceTask and tSinkTask use a binary semaphore initially set to 0 and a message queue with a length of 1 (also called a mailbox). tSourceTask sends the message to the message queue and blocks on the binary semaphore. tSinkTask receives the message and increments the binary semaphore. The semaphore that has just been made available wakes up tSourceTask. tSourceTask, which executes and posts another message into the message queue, blocking again afterward on the binary semaphore.
The pseudo code for interlocked, one-way data communication is provided in Listing 7.2.
The semaphore in this case acts as a simple synchronization object that ensures that tSourceTask and tSinkTask are in lockstep. This synchronization mechanism also acts as a simple acknowledgement to tSourceTask that it’s okay to send the next message.
- 7.7.1 Non-Interlocked, One-Way Data Communication
- 7.7.3 Interlocked, Two-Way Data Communication
- Класс Interlocked
- Информация заголовочной страницы (Database header)
- Database dialect
- DATABASE CACHE SIZE
- Data sending and control session
- SCTP DATA chunk
- Integrated Secure Communications System
- Data Binding Using the GridView Control
- Interbase DataPump
- GetDataBack