$25
Many students of CSE, BUET are travelling to Cox’s bazar by air to attend the NSysS conference. On arriving at the airport, each passenger performs self check-in at a kiosk which issues a boarding pass. There are M kiosks available. A passenger needs to wait in a line if a kiosk is not available.
Next, each passenger needs to pass through the security check and boarding gate to get on the flight. However, VIP passengers are allowed to skip the security check. They use a VIP channel to reach the boarding gate. Any number of passengers can walk simultaneously through the VIP channel.
Security Check: There are N belts. Each belt has a separate waiting line. After receiving the boarding pass from the kiosk a passenger can join any of the waiting lines. Each belt can serve P passengers at a time.
Boarding: There is only one line to board on the airplane. At the boarding gate, an officer checks the boarding pass one at a time. Passengers need to wait in a line for their turn. Some passengers are not very careful. They have lost their boarding passes. When a passenger fails to show the boarding pass at the gate, s/he is sent back to a special kiosk using the VIP channel which is used only by the returned passengers. The special kiosk can serve one passenger at a time. After getting the boarding pass, s/he walks through the VIP channel to come back to the boarding gate and waits in line for his/her turn.
VIP Channel: The VIP channel is basically a moving walkway, which runs usually in the direction from the kiosk to the boarding gate. Let’s call this direction Left-Right. It is also used to send back a returned passenger from the boarding gate to a special kiosk. Let’s call this direction Right-Left.
Any number of passengers can walk simultaneously through this channel in either direction. Since it is a moving walkway, it can be used in one direction at a time. The direction is manually changed by a staff member. The staff gives priority to the Left-Right direction and changes the direction only if there is no passenger who is ready to use the channel in Left-Right direction. If there is any passenger waiting on the Left side while the walkway is being used in the Right-Left direction, the staff only waits for the passengers to finish their walk who are already on the walkway. No new passenger on the Right side is allowed to enter the walkway.
Implementation Guideline:
● Each passenger should be given an unique ID. Some passengers can be assigned VIP status at random at the beginning.
● The timing of the operations should be implemented using sleep. The relative time for each operation is given.
● There MUST NOT be any busy waiting anywhere in the implementation ● Generate passengers using Poisson distribution. Use a suitable inter-arrival rate.
Operation Name
Relative Time Unit
Self check-in at a kiosk
w
Security check
x
Boarding at the gate
y
Walking on VIP channel in either direction
z
● Select passengers randomly during the boarding operation to lose the boarding pass.
● Print every move of a passenger in detail (with timing info). Samples are given just to show the output format.
● Input/Output:
○ You will take input from a file and give output in an output file ○ The format of the input file is:
M N Pw x y z
Where M = Number of kiosk
N = Number of belts for security checkP = Number of passengers each belt can serve w, x, y, z = relative time units for the operations ● Sample Input/Output:
Input
Output (complete for passenger 1) *
3 2 5
8 10 12 14
Passenger 1 has arrived at the airport at time 7
Passenger 2 (VIP) has arrived at the airport at time 9 [ this is just to show the output format for a VIP passenger]
Passenger 1 has started self-check in at kiosk 1 at time 14 [waited 7 time unit]
Passenger 1 has finished check in at time 22 [finished self check in 14 + w(8) = 22]
Passenger 1 has started waiting for security check in belt 1 from time 23
Passenger 1 has started the security check at time 30 [waited for 8 time unit for the belt to be available]
Passenger 1 has crossed the security check at time 40 [ 30 + x(10) = 32]
Passenger 1 has started waiting to be boarded at time 41
Passenger 1 has started boarding the plane at time 47 [ waited for 6 time unit in the queue]
Passenger 1 has boarded the plane at time 59 [47 + y(12) = 59]
*[text in [] is for explanation purpose; no need to print them in the output]
The waiting times are random here. In your program you will calculate the waiting times based on the interaction between the system and the passengers.