$30
CECS-326: Operating Systems
EXTRA CREDIT PROJECT
PIPES
Name: ____________________________________
Last, First
ABSOLUTELY NO LATE PROJECTS WILL BE ACCEPTED
PROJECT DESCRIPTION:
Write a program pipe using C/C++ to do the following.
A parent creates a child process and communicates with the child process via named and unnamed pipes.
Inputs to the program are provided by the command line arguments as follows:
pipe pipe_type pipe_name direction message
where:
pipe_type indicates type of pipe, ‘n’ for named and ‘u’ for unnamed.
pipe_name is the name of the pipe only if pipe_type is ‘n’; otherwise, pipe_name is not needed.
direction indicates message direction, ‘p’ for parent to child, ‘c’ for child to parent.
message is the message string, limited in size of 32 characters.
The sender will display the message to be sent and the receiver will display the received message in
opposite case. In other words, if the sender sends message in lower case, the receiver displays the message
in upper case and vice versa. Note that symbols other than alphabets remain unchanged. The child will
also display its process ID.
Examples of program output are shown below:
pipe n pipename c this_is_my_MESSAGE
child 6122 is about to send the message [this_is_my_MESSAGE] to pipename
message sent
parent is about to read the message from pipename
parent receives the message *THIS_IS_MY_message* from child 6122
pipe u p this_is_my_MESSAGE
parent is about to send the message [this_is_my_MESSAGE] to FIFO
message sent
child 6123 is about to read the message from FIFO
child 6123 receives the message *THIS_IS_MY_message* from parent
DOCUMENTATION:
The project must be carefully documented. The write-up must include: one page of problem analysis and
discussion (include a flow chart or structure chart when relevant), program listing with proper comments,
one page of output listing using all values of pipe_type and direction, covering all four different cases. The
discussion should include general considerations, UNIX function calls, any reasonable assumptions, and
any other relevant information. Attach this sheet as the front page of your project. Firmly staple the entire
project together. No folder is used.
END OF EXTRA CREDIT PROJECT