Thursday, 30 March 2017

Interprocess communication using POSIX Shared Memory in Linux | SoftPrayog

Interprocess communication using POSIX Shared Memory in Linux | SoftPrayog: "Shared memory, message queues and semaphores form the suite of interprocess communication (IPC) mechanisms available under Linux and other Unix-like systems. In case of shared memory, the system provides a shared memory segment which the calling process can map to its address space. After that, it behaves just like any other part of the process's address space.



 If we look at the other IPC mechanisms like message queue or the older mechanisms like the pipe or the fifo, the work required for passing message involves, first copying the message from the address space of the first process to the kernel space via a send-like system call and, then, copying the message from the kernel space to the address space of the second process during a receive-like call. In the case of shared memory, the first process writes data in the shared memory segment and the data becomes available to the second process immediately. This makes shared memory faster than other mechanisms and is, in fact, the fastest way of passing data between two processes on the same host system"



'via Blog this'

No comments:

Post a Comment