Home | | Embedded Systems | Interprocess Communication Mechanisms

Chapter: Embedded Systems

Interprocess Communication Mechanisms

1 Shared Memory Communication: 2 Message Passing



1 Shared Memory Communication:



In general, a process can send a communication in one of two ways: blocking or non blocking. After sending a blocking communication, the process goes in to the waiting state until it receives are sponse. Non blocking communication allows the process to continue execution after sending the communication. Both types of communication are useful.


There are two major styles of inter process communication: shared memory and message passing. The two are logically equivalent—given one, you can build an interface that implements the other. However, some programs may be easier to write using one rather than the other.


The input data arrive at a constant rate and are easy to manage. But because the output data are consumed at a variable rate, these data require an elastic buffer. The CPU and output UART share a memory area—the CPU writes compressed characters in to the buffer and the UART removes them as necessary to fill the serial line. Because the number of bits in the buffer changes constantly, the compression and transmission processes need additional size information. In this case, coordination is simple—the CPU writes at one end of the buffer and the UART reads at the other end. The only challenge is to make sure that the UART does not over run the buffer instruction returns true and the location is in fact set. The bus supports this as an atomic operation that cannot be interrupted. Programming Example 6.1 describes a test-and-set operation in more detail.


A test-and-set can be used to implement a semaphore, which is a language-level synchronization construct. For the moment, let’s assume that the system provides one semaphore that is used to guard access to a block of protected memory. Any process that wants to access the memory must use the semaphore to ensure that no other process is actively using it. As shown below, the semaphore names by tradition are P() to gain access to the protected memory and V() to release







/* some non protected operations here */


P(); /*wait for semaphore */


/* do protected work here */


V (); /*releases ema phore */


The P () operation uses a test-and-set to repeatedly test a location that holds a lock on the memory block. The P () operation does not exist until the lock is available; once it is available, the test-and-set automatically sets the lock. Once past the P () operation, the process can work on the protected memory block. The V () operation resets the lock, allowing other processes access to the region by using the P() function.


2 Message Passing


Message passing communication complements the shared memory model. As shown in Figure6.15, each communicating entity has its own message send/receive unit. The message is not stored on the communications link, but rather at the senders/ receivers at the end points. In contrast, shared memory communication n can be seen as a memory block used as a communication device, in which all the data a restored in the communication link/memory. Applications in which units operate relatively autonomously are natural candidates for message passing communication. For example, a home control system has one micro controller per house hold device—lamp, thermostat, faucet, appliance, and so on. The devices must communicate relatively infrequently; furthermore, their physical separation is large enough that we would not naturally


Think of them as sharing a central pool of memory.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Embedded Systems : Interprocess Communication Mechanisms |

Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.