A pipe connects the output of one process to the input of another process. The pipe syscall takes an array that’s 2 elements wide. The first element fds[0]
is the read end of the pipe, and the second element is the write end of the pipe fds[1]
. Pipe returns a file descriptor, so it operates as other file descriptors do.
pipe
: forms a one-way communication channel using two file descriptors.- This takes a 2-sized integer array
pipefd
.pipefd[0]
is the “read” end of the pipe, andpipefd[1]
is the “write” end of the pipe. - This is effectively a buffer managed by the kernel.
- We can take advantage of process forking to allow two processes to effectively communicate via the two ends.
- This takes a 2-sized integer array