UMBC CSEE Computer Science & Electrical Engineering
University of Maryland Baltimore County
Baltimore Maryland 21250 USA
voice: 410-455-3500 fax: -3969
UMBC| CSEE

Project 1: InterProcess Communications Using Pipes

(c) 2000, Gary L. Burt

Assigned: 25 Sep

Due: 9 October

Project Goals

The goals of this project are to learn the basics of how a process creation, InterProcess Communication (IPCs), file management, inheritance of files by child processes, and to gain experience programming with UNIX processes and system calls.

The Project

You are to design and implement a simple set of processes, where a parent creates two children. The two children are to communicate with each other via a pipe that you have used to replace the standard input and the standard output.

Specifications

Parent Process

The parent shall do error checking and abort on any error condition after printing an error message.

The parent process shall accept one argument from the command line, which is the name of an ordinary ASCII text file. (This should be in argv[1].) The parent shall create a pipe and create the two children. It shall print out its process ID and the PID of each child. When the parent completes successfully, it shall print out the message:

This was a successful project.

Child 1

After child 1 is created, child 1 shall close the standard in and standard out, and shall make the standard in to be the file opened by the parent. The standard shall become one of the parts of the pipe used for output. Since the child does not need the other side of the pipe, child 1 shall close it. Child 1 shall then run another program (called child1). The child1 one process shall read one line at a time from the standard input and write it on the standard out until the end of file is reached. At that time child1 shall terminate successfully.

Child 2

The second child shall change standard input to be the other side of the pipe and shall close the unused part of the pipe. It shall then cause a third program (child2) to execute. Child2 shall read one line at a time from the standard in and print the lines on the standard output (which is the terminal). The output shall be in the form of: <PID> lineNr (nrBytesRead): line An example would look like: <10526> 0 (13): root:x:0:root (The actual line of text from the file for this example (/etc/group) was: root:x:0:root

Grading

Make sure you have read the general information on programming projects. Approximately 20% of your grade is for documentation, and the remainder is based on how well your project works. You should describe your design and implementation at the beginning of the project; this initial description is worth 15% of your grade. Describe any non-trivial data structures you have used, and briefly say how each relevant routine acts on those data structures. The description should be about a half-page long. Do not ramble incoherently, and do not simply echo the specifications given here. The standards for documentation are:

Coding Standards

Indentation Standards

You must do the project described here. Every time the requirements uses the word "shall" is an item that you will get points for if you did it or loss points if you did not do it! Doing some other similar or dissimilar project, matter how difficult or clever, may be worth 0 points. This is not a group project; please do your own work, and be careful about sharing your code. It is OK to discuss design issues, but in your documentation, you should give credit to your sources.

What to turn in

You shall make a tar file out of your source code files, including your Makefile. You shall mail the tar file to the TA for grading.

Hints and Tips

Points to Ponder

Simple Pipe Sample Program

This will be handed out in class.

UMBC | CSEE |