Locking the message queues are unnecessary as the OS verifies the integrity of the queue and will not allow two processes to access the queue in a destructive manner. Although the message queues do have these advantages, they have two distinct disadvantages. Message queues are slow at transferring large amounts of data, and there is a hard limit to the size of the data packet that can be transfered. Therefore, message queues are best for slow data rates, with limited bandwidth. Shared Memory Second, shared memory will be examined.
Shared memory is a region of memory that can be accessed by multiple processes.
For example, when you declare an array in your local program of 1000 bytes, only your local program can access that array. With shared memory , you can declare a shared memory segment of 1000 bytes and multiple processes can read and write from this shared memory . The primary advantages of shared memory is that your program views it exactly the same as normal memory. In addition, reading and writing to and from shared memory is very fast. Using shared memory is relatively simple.