Named Pipe in Computing

Named Pipe


The Ordinary pipe in Operating System provides a simple mechanism for allowing a pair of processes to communicate. However, ordinary pipe exists only while processes are communicating with one another. On both UNIX and Windows systems, once the process finishes communicating and has terminated, the ordinary pipe ceases to exist.


Name pipe provides a much more powerful communication tool. Communication can be bi-directional and no parent-child relationship is required between process, this means that now more than two process can communicate with each other a time. Once the pipe is established, several processes can use it for communication. In fact, in some scenarios a named pipe has several writers. In addition, named pipes exist after completion and termination of all the processes. Both UNIX and Windows systems support named pipes, although details of implementation differ greatly.

In UNIX Systems


Name pipes referred to as FIFO (first in first out) in UNIX systems. Once they created. They appear as typical files in the file systems. A FIFO is created with the mkfifo() system call and manipulated with open(), read(), write() and close() system calls. FIFO supports two-way communication, only half-duplex transmission is permitted.

In Windows Systems


In Windows named pipes provides a richer communication mechanism between processes rather than UNIX systems. Full-duplex communication is allowed in Windows named pipe implementation. The communication may run from either different sides or from the same side of the pipe at a same time. Name pipe is created with CreateNamedPipe() function, and a client can connect the named pipe using ConnectNamedPipe(). Communication over the named pipe can be accomplished using the ReadFile() and WriteFile() functions 


Previous
Next Post »