Os Shared Memory

From Java4c

(Difference between revisions)

Revision as of 21:22, 5 March 2011

Shared memory is a memory-area, which is able to access from more as one process. It is a possibility given in some platforms. A process in this meaning is a portion of software maybe with more as one thread, which is running on the same platform simultaneously with other processes. But the processes are separated in the usage of the resources. Especially they haven't a common memory. It is to protect the processes against failures in the software.

The shared memory is not a mechanism, which is able to use on any platform. Therefore it is not a part of the common OSAL interface definition.

If shared memory is used, it is a problem of the communication between processes. Therefore the mechanism of InterProcessCommunication should be used instead:

  • InterProcessComm.open(ChannelSpec); to open a communication channel. It may create a shared-memory-access-object.
  • InterProcessComm.receive(...);: Receive any data from another process. It may check the shared memory whether expected information are given. It is not specified which addresses and which information inside the shared memory are checked. The receive operation is a broadcast-receive. To specify a finer granularity in information-receiving, there should be more as one open(...)-operations which are associated to parts of information in the shared memory. The receive(...)-operation is more wait for event-adequate as read memory. But usual it is it, which are expected in a communication between processes. The user should rather think about I will use the shared memory but I have to get events from another process.
  • InterProcessComm.send(data, address);: it sets informations, maybe setting values in the shared memory
Personal tools