Design of Assignment 2 Solution





  1. Read from input file

  1. Ask user for memory and page size

  1. Load processes into the input queue

  1. Move processes from the input queue to memory

  1. Move processes out of memory and deallocate frames

  1. Compute average turnaround time


Read input file: input file is read using fstream

Ask user for memory & page size: functionality is done with a “cin” and stores values

Load processes into input queue: check if the current time is equal to a processes arrival time then we can push it into the input queue if not then it is ignored

Move processes from the input queue to memory: check if total memory size of a process has enough frames that can be allocated if true we push the process into memory if false we either wait until it can be pushed to memory or if the process exceeds the total memory we ignore it

Move processes out of memory and deallocate frames: once a processes total execution time has finished, we move that process out of memory and call a function which will then deallocate those frames from our data structure which represents our memory

Compute average turnaround time: take the processes total completion time and subtract it by the process’s arrival time. Then we can add the turnaround times for all the processes and then divide that number by the total amount of processes to get our average turnaround time.

Diagram on next page

error: Content is protected !!