Question: build a C/C++ program to simulate the following scenario Mother and child enters a grocery store. Mother acts as the Parent Process and the child

 build a C/C++ program to simulate the following scenario Mother and

build a C/C++ program to simulate the following scenario Mother and child enters a grocery store. Mother acts as the Parent Process and the child acts as the Child Process Mother goes to do her grocery buying while the child goes to the toys or books area. But the deal is that the child must send a message to the mother saying "I am doing all right mom" in every 3 seconds while the mother sends a question to the child "Are you doing all right" every 10 seconds After 55 seconds, mother almost finishing shopping, and sends a message to the child that she will be done in 5 seconds and asks the child to come to the store front (e g: "OK. I am done in 5 seconds, now come to the main door...". Child receives the message and sends message "OK mom. I am coming" However, children are children, they are slow, and waits, and look at anything attracts them. So the child get delayed for 5 seconds. The is losing patience a bit that the child is not at the door yet, so the mother prints a message or two MAKE SURE to put appropriate print statements to indicate the start of the simulation, when the child process is created and to indicate that the mother and child are on their own directions. Note that, when multiple processes run, print statements get mixed up; so make sure to indent all child's messages. Also put an indication to identify the owner of the message such as, having a Mom Received: or a Child Received: preceding the messages by the Mother and Child respectively. Here is a full 65 second example simulation. This is a real world simple simulation. In your code, it is a MUST you use the system calls fork() and IPC system calls such as pipe(). You can use sleep() to control the execution speed and timers (if necessary) in addition to the other system calls you have learnt so far in the course. Just do not limit to fork() and pipe other and child enter grocery store. other is now doing shopping hild process with id 0 is created hild is now on his awn. possibly in toys on Received: I a doing all right mon on Received: I a doing all right mon om Received: I am doing all right mom on Received: I am doing a11 right inom Child Received: Are you doing all right? on Received: I am doing all right mO on Received: Iam doing all right mom on Received: 1?, doing all right mom on Received: 1 ern doing 11 right mom Child Received: Are you doing all right? Note: IF YOU NEED FULL CREDIT, YOU MUST STRICTLY SHOW/USE IN CODE PROPER SYSTEM CALLS AND MUST ADHERE TO THE MESSAGE CONTROL DESCRIBED IN THIS DOCUMENT. IF YOU DO NOT USE SYSTEM CALLS AND TIMING AND STILL PRODUCE AN OUTPUT TO MATCH THE GIVAN OUTPUT YOU GET ONLY 30% OF THE GRADE om Received: I am doing all right mom or, Received: 1 doing all right mon on Received: 1 ?" doing 11 right mom on Received: I a doing all right mon Child Received: Are you doing all right? on Received: I am doing a11 right mom on Received: I am doing all right mon on Received: I am doing all right mo on Received: Iam doing all right mom Child Received: Are you doing all right? on Received: I am doing all right mon on Received: I am daing all right mom om Received: I am doing all right mom 55 second simulation completin .- mom sends a nessage Child Received: OK. I an done in 5 seconds, now cone to the main door ors Received: 1 , coning nor :I an waiting

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!