Illustrate pipes? Explain their limitations. Explain how named pipes are replaced to overcome the drawback of pipe in ipc with remember acs109.11 an examples
Answers
Pipe is one-way communication only i.e we can use a pipe such that One process write to the pipe, and the other process reads from the pipe. It opens a pipe, which is an area of main memory that is treated as a “virtual file”.
The pipe can be used by the creating process, as well as all its child processes, for reading and writing. One process can write to this “virtual file” or pipe and another related process can read from it.
If a process tries to read before something is written to the pipe, the process is suspended until something is written.
The pipe system call finds the first two available positions in the process’s open file table and allocates them for the read and write ends of the pipe.
Pipes:-
A pipe server and one or more pipe clients can communicate among themselves via named pipes. Compared to anonymous pipes, which enable inter process communication on a local machine, they give additional capability.
- A pipe can be used so that one process writes to it and another process reads from it. This is known as one-way communication. It begins by opening a pipe, a portion of main memory that functions as a "virtual file."
- The producing process, along with all of its offspring, can read from and write on the pipe. This "virtual file" or pipe can be written to by one process, and read from by another process that is connected to it.
- A process is halted until something is written to the pipe if it tries to read before anything has been written.
- The pipe system call locates the process's open file table and allocates the first two available places to read and write the pipe's ends.
#SPJ2