Nicolò Gasparini
Nicolò Gasparini

Reputation: 2396

Pipe between child processes

Is it possible to create a pipe between 2 or more child processes?
If so, does it have to be created by the father or can it be created by one of the childs?

Upvotes: 0

Views: 46

Answers (1)

tofro
tofro

Reputation: 6073

Yes, it is possible to create pipes between child processes.

The pipe identifier needs to be known by both ends in order to be able to connect to it - But how should they exchange this identifier when they are not connected already? This is why normally pipes are created by a common ancestor that communicates this common identifier to all its children on creation.

What you seem to be looking for is named pipes - These can be opened by a commonly known (by convention) name without receiving information first. Named pipes are, however, not connected to the life-time of a process - You need to have some outside instance that creates and destroys them when they are no longer needed. Otherwise, they will continue to use system resources until the system is rebooted.

Upvotes: 1

Related Questions