Reputation: 2785
what is main difference between shared memory and pipe in unix programming?
Upvotes: 6
Views: 3858
Reputation: 2033
Shared Memory Vs Pipe-
Kernel-
Once Shared Memory is setup by the kernel there is no further need of kernel for the communication b/w process whereas in Pipe, data is buffered in the kernel space and requires system call for each access. Here, Shared Memory is faster than Pipe. It is a major drawback of the pipe becuase IPC is important for the computational speed up.
Communication
Shared Memory- Bidirectional whereas Pipe(unnamed Pipe)- Unidirectional.
Reliable
Shared Memory- Less Reliable(data mix up) whereas Pipe is more Reliable as data is buffered and is under control of the kernel.
Hope you like it.
Upvotes: 2
Reputation: 55489
Taken from this article
(unnamed) Pipes
Shared Memory
Upvotes: 7