Beruflich Dokumente
Kultur Dokumente
1 20 5 2 22 4 3 23 2 4 30 3 2. Dispatch the processes using First-In-First-Out algorithm. A possible partial scenario of executing the algorithm using the above data should look as follows (A stands for arrival, D stands for Departure). Note the purpose of Queue is to perform FIFO and the purpose of List is to sort and log processes based on time: Time 0 20 Action Read file, place process in the List Update the List and Queue: 1. Process 1 enters the queue 2. Process 1 begins execution, create departure log in the list 3. Read file, place process in the list Update the List and Queue: 1. Process 2 enters the queue 2. Read file, place process in the list Update the List and Queue: 1. Process 3 enters the queue 2. Read file, place process in the list Update the List and Queue: 1. Process 1 departs the queue 2. Process 2 begins execution Queue empty [(20,5)] [(20,5)] [(20,5)] [(20,5),(22,4)] [(20,5),(22,4)] [(20,5),(22,4), (23,2)] [(20,5),(22,4), (23,2)] [(22,4), (23,2)] [(22,4), (23,2)] List [(A,20,5)] Empty [(D, 25)] [(A,22,4),(D,25)] [(D,25)] [(A,23,2),(D,25)] [(D,25)] [(D,25),(A,30,3)] [(A,30,3)] [(D,29),(A,30,3)]
22
23
25
continue continue
Requirements: 1. YOU ARE NOT ALLOWED TO USE ANY STANDARD TEMPLATE LIBRARY (STL) EXCEPT VECTOR. Namely, you need to construct queue and list from Node.h. Failure to follow this requirement will result in ZERO point. 2. Possible files needed: Event.h, Node.h, List.h, Queue.h, Simulation.h, Driver.cpp 3. After simulation, print out all the logs (which process enters or departs the process at what time, similar to the above table) 4. Compute the waiting time of each process and print the result at the end of Driver file (Definition: Waiting time: The period of time waiting in the queue before the process is executed. For example, the waiting time for Process 2 is 3 second (2522) and the waiting time for Process 3 is 6 (29-23)).