Question: Write a C program which will have to create a child process. Then you must use ordinary pipe ( s ) to implement a half

Write a C program which will have to create a child process. Then you must use ordinary
pipe(s) to implement a half-duplex communication between the parent process and the
child process where both processes can exchange messages.
To test your program the parent and child will exchange some messages, the parent will start
first by sending the first message, then the child will respond Messages should get
exchanged through pipes, and each message received from both parties should get displayed
on the screen. A delay of 2 seconds should be added between each consecutive message
display (you can use the sleep() function for this).
The output of your program should look exactly like this (in total 4 exchanges of messages
between Parent and Child processes):
"Greetings son
Hello dad
How are you son
Fine dad thanks"
You should implement one read and one write buffers to send and to receive messages e.g.,
char write_msg[BUFFER_SIZE];
char read_msg[BUFFER_SIZE];
Buffers declaration should be done in the main() function (first two line right after
main()); Use strcpy() function; to assign/update a message in a buffer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!