subject

Kindly help me in this question by C PROGRAM or BY WORDINGS WHICH DESCRIBES THE PROBLEM SOLUTION Suppose you are owner of a Burger spot and you can make 10 burgers at max. Now, you have several customers to buy it, but let us consider only one customer. So you can make one burger at a time and customer take it. Implement this scenario using process(fork).
1. If your shop has 0 burger; then you need to send a message to all your customers to sleep(customer).
2. If your shop has 1 burger, then it sends the Customer a message that wakeup(customer).
3. Until chef make 10 burgers, chef is asked to continues to make burgers.
4. If burgers == 10, chef goes to sleep(chef) until customer buys a burger and chef continues to sleep until burger != 0. When burger == 0 then sends the chef a message to wakeup(chef).
But this management has some problems like:
• Chef is making burger and at the same time customer wants to take it. At the same time; the customer thinks that burger is ready while there are no burgers and hence is still producing. So, one can understand that it creates a mess!
• Now, customer just saw there are no burgers, then is about to go to sleep. Now, before customer goes to sleep; what if chef makes a burger? And after the chef has just made a burger; the shop sends the message to the customer “Wake up!”. But since, the customer is about to sleep(as he had got to know that there were no pizza), and hence he is still awake, so the “Wake Up” call of the baker is wasted! Actually that Wake-Up call was to awake the ‘Sleeping’ Customer! But due to lack of Sync, this happened.
• Now, when chef made 1 burger, customer didn’t turn up. Chef continues to make burgers until the 10 burgers are ready! But as per our scenario 2, the customer is awakened when the burger==1; but here burgers gets incremented by the Chef; so burger never will be equal to one and Customer goes into infinite sleep. This condition isn’t acceptable right?
You need to solve this problem that no one gets infinite sleep and chef serves the customer properly without any wait.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 22.06.2019 18:10
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
question
Computers and Technology, 24.06.2019 22:10
How many different ways are there to order the eight jobs in the queue so that job usu comes somewhere before cdp in the queue (although not necessarily immediately before) and cdp comes somewhere before bbd (again, not necessarily immediately before)?
Answers: 1
You know the right answer?
Kindly help me in this question by C PROGRAM or BY WORDINGS WHICH DESCRIBES THE PROBLEM SOLUTION Su...
Questions
question
Mathematics, 21.10.2020 02:01
question
Mathematics, 21.10.2020 02:01
question
Mathematics, 21.10.2020 02:01
question
Chemistry, 21.10.2020 02:01
question
Mathematics, 21.10.2020 02:01
question
Medicine, 21.10.2020 02:01
Questions on the website: 13722360