讲解progresses留学生、辅导c/c++编程语言、C++辅导、讲解programming skills 解析C/C++编程|讲解Dat

- 首页 >> Web
Assignment 2
Introduction
As we discussed in class, process become blocked whenever they are waiting for a
resource or for an operation to complete. In air-travel a similar situation occurs when
a plane for a particular flight is delayed (or is not available). This is a primary cause
of increasing delays as the day progresses.
The purpose of this assignment is
1. Reinforce the idea of blocking and its effect on scheduling.
2. To implement blocking mechanisms similar to ones in an operating system.
3. To further improve your programming skills. In this assignment you will extend the
air transportation simulator by adding the ability to block flights when the plane
required for the flight is not available.
Background
This assignment assumes all the background described in Assignment 1. Flights
require an important piece of equipment to proceed: a plane. At the start of the day, a
plane is assigned to the first flights. When a flight arrives at an airport, the plane is
cleaned up (“groomed”) and then used for another flight departing from the same
airport. When that flight ends, the plane is again groomed and assigned to another
flight departing from its new location. The plane identifier (PID) is used to uniquely
identify each plane and is part of the flight information. Naturally, if a plane is
delayed or breaks down, flights that rely on it may be delayed (or canceled) as well. It
is a common (unpleasant) experience to be waiting at the gate and being told that the
plane has not yet arrived. Once a plane arrives, it takes at least 30 minutes to groom
the plane in preparation for departure. Once the plane is groomed, the flight that will
use it can depart on or after its
scheduled departure time. Thus, an additional 30 minutes must be allowed between
when a plane arrives and departs. Note: The first time a plane is used, it is already
groomed and can depart at the flight’s appointed time. Your task will be to implement
this aspect of scheduling in the air traffic simulator called atsim. You can either
extend your own version, which you submitted for Assignment 1, or the provided
Assignment 1 solution.
Simulator Input
The input is the same as Assignment 1. Please see examples as shown in the provided
test suite (tests_2.zip).
Processing and Semantics
All processing rules described in Assignment 1 apply, in addition to the following:
Each plane is identified by a plane ID that is in the range 0 . . . 999. The plane used by a flight must be at the same airport as the origin of the flight.
Each plane is initially at the same airport as the first flight that will use it. E.g., If the
first flight to use plane 42 originates in YHZ, then initially plane 42 is at YHZ.
If a plane is being use by a flight, no other flight can use it until the flight
completes and the plane is groomed.
After a flight completes (arrives at the gate), the plane associated with the flight
takes 30 minutes to groom. I.e., there is a 30 minute interval between the arrival and
departure of the same plane.
Once a plane is groomed, the flight to use the plane may depart from the gate
immediately. If no flight needs to use the plane immediately, the plane remains at the
airport until it is used.
Reminder: The simulation completes once all the flights have completed or the day
has ended.
Expected Output
The output is the same as Assignment 1. Please see examples as shown in the
provided test suite (tests_2.zip).
Hints and Suggestions
1. Each airport will need a list to keep track of all blocked flights that are waiting for
their plane. 2. Either a global or per-airport table of planes and their status will be
useful. 3. The sample solution to Assignment 2 only required modifying the airport.c
file and required 55 lines of additional code.

站长地图