I’m trying to understand the usage of pipe.
A parent process will pipe and if the parent forks, the child process will inherit the pipe. So now we hae a direct link to the child process and they can communicate?
I get lost when we start to close pipes and redirect pipes. Does anyone have a good explanation on closing pipes and redirecting pipes?
Thank you in-advance.
Here’s the deal.
Here is what it looks like:
Your question was specifically about closing and redirecting. That comes into play when you perform the switch I referred to earlier. Let’s say you have obtained a pipe by using the pipe() system call.
Now you create a child process, and in that process perform the switch, like so: