$29
CIS 345/CIS 545 Assignment 1
Inter process communication
Points: 30
Write an inter process communication program in C language to exchange message
between parent process and child processes. This Assignment is aimed to learn
fork() and pipe() functionalities.
1. You are expected to create a program where parent process P1 should send a
message “Hi, I am your parent from CIS 345 ” to the child process P2, P3. To
create a child process use fork(). Child processes should send the
acknowledgement ”Message from Child 2: RECEIVED” to the parent
process after receiving the message.
2. To exchange/communicate the message, use pipe().
pipe() is unidirectional data exchange channel.
3. Submit your document to TA (Email: liangjy10@gmail.com) and your instructor
through blackboard course message with the following:
a. working code (10 points)
b. code explanation/documentation (10 points)
c. screenshots with timestamp (10 points)
4. Use Fenn Hall lab (FH128) systems or virtual Linux machines to execute the
program.
5. Mention individual contribution of each member (in percentage) and include
your team members in email list while submitting the assignment.
6. Email subject and Document name should use the following format.
CourseID_AssignmentNumber_GroupNumber <e.g:
CIS345_Assignment3_Group10 >
Sample structure:
int main()
{
// Fork() declaration section
if(pid==0)
{
printf("the first child\n" );
}
else if(pid>0)
{
printf("the first parent\n");
wait();
}
if(pid1==0)
{
printf("the second child\n" );
}
else if(pid1>0)
{
printf("the second parent);
wait();
}
return 0;
}
Hint: You can use the above code or you can modify the above program for child
process, if required. It is not mandatory to use the same code.