06-08-2013, 04:26 PM
Pipes in UNIX
AIM:-
Study & Implementation of program for Pipe system call
OBJECTIVE:-
To check how data transfer data from one process to another process.
RELEVANCE:-
To Transfer data from one process to other in FIFO manner & synchronization between process.
THEORY:-
PIPE:-
Pipes allow transfer of data between processes in first-in-first-out(FIFO),& they also allow synchronization of process execution. There is two kinds of pipe –Named pipe and Unnamed pipe . The system use open system call for the named pipe & pipe system call for the unnamed pipe.
Opening a named pipe:-
A named pipe is file whose semantics are same as those of unnamed pipe ,except I has a directory entry and is accessed by path name. Process open named pipe is as same as regular file. The algorithm for opening the named pipe is similar to algo. used for opening the file. Before completion the system call, the kernel increments read or write counts in the inode, indicating number of process that have named pipe open for reading & writing. A process that opens the named pipe for reading will sleep until another process open the named pipe for the writing & vice versa .Depending on whether the process opens the named pipe for reading or writing ,the kernel awake the other processes that sleep ,waiting for the reader or writer process on the named pipe.
Reading & Writing Pipes:-
A pipe should be viewed as if processes write into one end & read from other end The number of process reading the pipe is not mercenary same as the number of process writing the pipe. The kernel access the data for pipe is exactly same as it access data for file. The diff. between storage allocation for pipe & the regular file is that pipe uses only direct blocks of the inode for grater efficiency.
Conclusion:-
In this way we have studied how to Transfer data from one process to other in FIFO manner & synchronization between process.