Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: IPC and Simulations Using system calls you have learned so far in the course and paying special attention to system calls in chapters1 5

image text in transcribed

Goal: IPC and Simulations Using system calls you have learned so far in the course and paying special attention to system calls in chapters1 5 and 10, 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 "l 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 again "I am waiting....come on..." 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 a grocery store. other is now doing shopping hild process with id 0 is created hild is now an his awn.possibly in toys... on Received: I a doing all right mom on Received: I am doing all right mom on Received: Iam doing all right mom ors Received: 1 at, doing a11 right mom Child Received: Are you doing all right? on Received: I am doing all right mon om Received: I am doing all right mon on Received: I an doing all right mon on Received: I am doing all 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 mon on Received: I am doing all right mon on Received: I am doing all right mon on Received: I am doing all right mom child Received: Are you doing al1 right7 on Received: 1 ?, doing all right mom on Received: I am doing all right mo on Received: I a doing all right mom om Received: I am doing all right mon Child Received: Are you doing all right? on Received: I am doing all right mom on Received: I am doing all right mon on Received: I am doing al right mon 55 5econd simulation c?pl eting.. rom sends a res sage Child Received: oK. I an done in 5 seconds, now cone to the main door on Received: I am coning mon :I a waiting

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions

Question

Under what condition will MSC = MPC? When will MSB = MPB?

Answered: 1 week ago

Question

How can leaders be most effective?

Answered: 1 week ago