Search for question
Question

A sushi shop provides a stream of sushi for customers. The sushi are made by a chef in the kitchen and placed on a conveyor belt. The conveyor belt carries

the sushi to where the customers are waiting to buy them. This scenario has been simulated using two processes: the chef and the customer, and a shared conveyor belt implemented as an array called conveyor with finite size, where each space in the array can hold one sushi.In this scenario, there is only a single chef and a single customer. The pseudo-code for the chef is as follows. This code should be familiar to you as it is similar to the example of the Producer-Consumer problem. Only a few sentences are required for each of the questions below. (a) (10 marks) The pseudo-code for the chef has an error. Propose the solution by giving the correct code and explain the reason in few sentences. (b) (10 marks) Give the pseudo-code for the customer. (c) (20 marks) Now assume that there is a single chef and a single customer, with a conveyor belt of infinite size. Give the pseudo-code for this scenario, both for the chef and customer.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7

Fig: 8

Fig: 9