Question: Problem description: Suppose, there is a sightseeing tour in the town every Friday, the tour includes three VIP busses; the number of passengers (seats) for

 Problem description: Suppose, there is a sightseeing tour in the town

Problem description: Suppose, there is a sightseeing tour in the town every Friday, the tour includes three VIP busses; the number of passengers (seats) for each bus is 12. The tour tickets are sold from five tickets sales machines. Each seller will sell until all tickets get finished. We assume a central line of customers exists. The program should dispatch each customer randomly among the 5 selling machines. Each machine selects each bus randomly to get a seat. If the selected bus is full, the machine selects another bus. The bus no. and the seat no. are selected randomly. At the end of the task, the program should print all tickets for each bus. The ticket info should be printed as follows: Seller ID, Bus ID, Passenger ID, Seat ID. Your task is to implement the previously discussed selling process; all sellers are implemented as different threads. They run concurrently and perform the process randomly. The synchronization technique to be implemented is Semaphore. Tips for proper implementation: . . Think of the required global variables, arrays, or structures. Think of the random selection technique of the bus and the seat. Think of the random serving of customers/passengers from the line. Think of the way to check availability of the bus and then the seat. Think of the critical part /shared resources to highly ensure the synchronization

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!