CSE314 Assignment 4-A journey by Air Solved

30.00 $

Category:

Description

Rate this product

A journey by Air

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

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 toshow the output format.
  • ●  Input/Outpu:
    • ○  You will take input from a file and give output in an output file
    • ○  The format of the input file is:MNPwxyz

      Where M = Number of kiosk
      N = Number of belts for security check
      P = Number of passengers each belt can serve w, x, y, z = relative time units for the operations

  • ●  Sample Output format:
    • ○  Passenger 1 has started waiting in kiosk 1 at 2
    • ○  Passenger 2 (VIP) has started waiting in kiosk 2 at 4
    • ○  Passenger 1 has got his boarding pass at 8
    • ○  Passenger 1 has started waiting for security check in belt 2 at 14
    • ○  Passenger 1 has crossed the security check at 20
    • ○  Passenger 1 has boarded the plane at 28
    • ○  Passenger 2 (VIP) has arrived at VIP channel at time 16
    • ○  Passenger 2 (VIP) has crossed the VIP channel at time 22
  • IPC-j8p2ga.zip