pipe.pptx (Size: 322.57 KB / Downloads: 19)
Pipe is a device used for the interprocess communication
Pipe has the functions create, connect and delete and functions similar to a
device driver (open, write, read, close)
Writing and reading a Pipe
A message-pipe─ a device for inserting (writing) and deleting (reading) from that between two given inter-connected tasks or two sets of tasks.
Writing and reading from a pipe is like
using a C command fwrite with a file name
to write into a named file, and C command
fread with a file name to read into a named
Write and read using Pipe
1. One task using the function fwrite in a set
of tasks can write to a pipe at the back
pointer address, *pBACK.
2. One task using the function fwrite in a set
of tasks can read from a pipe at the front
pointer address, *pFRONT
Pipe as IO Stream
Pipes are also like Java Piped Input Output Streams. Java defines the classes for the input output streams
In a pipe there may be no fixed number of
bytes per message with an initial pointer for
the back and front and there may be a
limiting final back pointer.
• A pipe can therefore be limited and have a
variable number of bytes per message
between the initial and final pointers
Unidirectional feature in Pipe
Pipe is unidirectional. One thread or task
inserts into it and other one deletes from it.
1. pipeDevCreate ─ for creating a device
2. open ( ) ─ for opening the device to enable its
use from beginning of its allocated buffer, its
use with option and restrictions or permissions
defined at the time of opening.
3. connect ( ) ─ for connecting a thread or task
inserting bytes into the pipe to the thread or
task deleting bytes from the pipe.
4. write ( ) ─ function for inserting (writing) into
the pipe from the bottom of the empty memory
space in the buffer allotted to it.
5. read ( )─ function for deleting (reading) from the pipe from the bottom of the unread
memory spaces in the buffer filled after
writing into the pipe.
6. close ( ) ─ for closing the device to enable its
use from beginning of its allocated buffer only
after opening it again..