Design a dispatcher based on simple *round robin*. Make the following assumptions:
a) ? ? ? the size of internal memory is 120K, and it is divided into 30 page frames; thus, the size of each frame is 4K.
b) ? ? ? the size of every process in the system is a number in the range from 4K to? 36K; thus, the size of every process is from 1 to 12 pages. In fact, every page in this simulation will be represented just by its number (i.e. a number between 1 and process_size).
c) ? ? ? when a process is generated, it is allocated 3 free page frames that can be filled on demand basis (that is, the dispatcher uses local policy, creating a separate page table for every process). As pages are represented just by numbers, frames can be just integer variables (in fact, it would be convenient to create an array int frames[30] of all the frames in this simulation of RAM).? ?
d) ? ? ? the lifetime of every process is a number in the range from 1 to 10.
? ? ? ? ? ? ? ? ? ? ?
## Deliverables
**The project MUST be implemented using one of the following programming languages: C, C++, C#, or Java (no VB!). If you use C, C++, or C#, you MUST use a dynamic queue using pointers for the round robin queue of processes. If you use Java, then you MUST use a Vector or Queue structure of Java for this purpose.**
?
? ? ? ? ? ? ? ? ? ? ? Hand in the text of the program and scripts of four runs ??" two using FIFO and two using LRU. Your program should print out:
a)? ? ? ? ? sizes, b) lifetimes, c) the moments of creation, d) the moments of completion of generated processes, e) reference string, indicating page faults for each process, and at which moments of execution these faults occurred.
For example, if, at the clock tick 25, a process that is picked to run does not finish, the corresponding part of the output could look like that:
? ? ? ? ? ? **? ? ? ? ? Clock tick 25:** ? process 8 is picked to run; lifetime: 5
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Page 4 is referenced; page fault has occurred;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Page 4 replaces Page 3 in a frame;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Remaining lifetime: 4
If, for example, at the clock tick 40, a process that is picked to run is finished, the corresponding part of the output could look like that:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? **Clock tick 40:** process 6 is picked to run; lifetime: 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Page 3 is referenced; no page fault;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Remaining lifetime: 0. Process 6 is deleted from the queue.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Process 40 is generated: size ??" 5 pages, lifetime ??" 9.
? ? ? ? ? ? ? ? ? ? ? Determine and submit the average turnaround time for each run (using turnaround time of only those processes that have been completed within 100 steps of iteration).
?
Extra credit (15 pts); you may implement two queues ??" one, with higher priority, using two time quantums for one run, the other one using just one time quantum; the scheduler uses two queues on alternative basis. Processes are to be distributed between queues as follows: if the (randomly generated) lifetime <6, the process is sent to the higher priority queue, otherwise, to the lower priority queue. If one of the queues becomes empty, then the next generated process is sent to the empty queue.
? **? ? ? ? ? ? ? **
**Requirement:? ? **A? copy of your (well-documented) code and files containing outputs of four runs of your program, two for FIFO, and two for LRU.