Operating Systems Project


    This project was for my Operating Systems class and was develop with a group of three other students. We had to implement a solution to this problem using semaphores:

    A runway of airplanes at an airport. The runway can have only one plane on it at one time. There are two types of planes: planes taking off and planes landing. For each plane that takes off, one must land. As well, planes must take off in the order in which they enter the takeoff queue. Planes must land in the order in which they enter the landing queue. Use semaphores to design a synchronization scheme with some properties.

    First, we define our planes to have times of how long they takeoff and fly for. For instance, Airplane 1 has a takeoff time (Runway Time) of 5 seconds and a fly time (Flying Time) of 1 second. Each plane also has how many times it can takeoff before the plane is ground and taken off of the flying queue. This way the program can end. With the runway as our shared resource, we had two threads that deal with the flying planes and landed planes. The thread that deals with flying planes takes the first plane in the flying queue, has it wait for it finish flying, then lands it to inside of the Hanger. Then the thread that deals with landed planes takes over the Runway and has a plane takeoff from the Hanger. This continues until all planes have be grounded and the airport is empty.