Why only related processes can only communicate using pipe() (IPC)?
ipc, pipe, unix
Solution
There do have limitation.
Pipe use `fd` to read/write data, `fd` is per-process, a process maintain a `fd` table, child inherit the `fd` table when fork, and each inherited `fd` refer to the same `open file` as in parent process, which is maintained by kernel.
Processes that communicate via the same pipe should be related.
It means, the 2 processes should both aware of the 2 `fd` of the pipe.
`<TLPI>` says:
The pipe should be created by a common ancestor before the series of `fork()` calls that led to the existence of the processes.
Problem
why does there is limitation that with pipe() only parent and child process can communicate, why not unrelated processes? why can't two children of a process can't communicate using pipe()?