0% found this document useful (0 votes)
62 views1 page

Lab 6 Pipe

This document discusses interprocess communication using pipes in Linux. It explains that pipes allow two processes to communicate by writing data to one end and reading from the other. The pipe acts as a FIFO buffer, blocking writes to a full pipe and reads from an empty pipe. It provides an example C code for creating a pipe using the pipe() system call. The goal of the lab is to have two processes communicate using a pipe: process 1 takes user input and passes it through the pipe to process 2, which checks the input against a bank database and returns the user's record index or -1.

Uploaded by

Jordan Zu'bi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views1 page

Lab 6 Pipe

This document discusses interprocess communication using pipes in Linux. It explains that pipes allow two processes to communicate by writing data to one end and reading from the other. The pipe acts as a FIFO buffer, blocking writes to a full pipe and reads from an empty pipe. It provides an example C code for creating a pipe using the pipe() system call. The goal of the lab is to have two processes communicate using a pipe: process 1 takes user input and passes it through the pipe to process 2, which checks the input against a bank database and returns the user's record index or -1.

Uploaded by

Jordan Zu'bi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Hijjawi Faculty for Engineering Technology Computer Engineering Department System Programming Lab (CPE 466)

Lab 6: Interprocess communication, Pipe

Goals:
Detailed Interprocess communication using pipe.

Background:

Interprocess communication (IPC) refers to the coordination of activates among cooperating processes. A common example of this need is managing access to a given system resource. Pipe is a simple synchronized way of passing information between two processes. A pipe can be viewed as a special file that can store only a limited amount of data and uses a FIFO access scheme to retrieve data. In a logical view of a pipe, data is written to one end and read from the other. The system provides synchronization between the reading and writing process. It also solves the producer/consumer problem: writing to a full pipe automatically blocks, as does reading from an empty pipe. On the other hand ,if no process has a pipe open for writing, a read from an empty pipe returns 0,indicating an end of file condition. #include <unistd.h> int pipe(int fds[2]); This system call is used to create a read-write pipe. The call takes as an argument an array of 2 integers that will be used to save the two file descriptors used to access the pipe. The first is to read from the pipe, and the second is to write to the pipe. If the call to pipe() succeeded, a pipe will be created, pipes[0] will contain the number of its read file descriptor, and pipes[1] will contain the number of its write file descriptor. Practical: Build a small database that has a limited number of records of clients information in a certain bank such as clients ID, password and balance. Then implements the following scenario: Process number one lets the client to enter his ID and password then passes them to process number two that checks if this client exist in the bank database or not , if it exist it will return the index of this client in the database , else it will return -1. According to the return value of process number two , process number one views the clients balance or error message.

GOOD LUCK

You might also like