In this lab, you will look at some memory allocation schemes and their performance.
Your program should read process PIDs, memory requests and the times required for their execution from a file or user input. It should update memory allocation once every time unit. The output from your program must be a line every time unit indicating which processes are currently in memory, their starting address and how much memory is given to them. It should also output internal and external fragmentation information (note that either of them can be 0 at a given time).
The following is a list of processes, their arrival times, memory requests (in units of 128 MB, i.e., 4 means 4x128=512 MB) and time for execution. Assume that you have a system with a total memory of 4 GB. In what sequence are the processes executed and when will they complete execution if the above memory allocation schemes are used?
PID | Arr. Time | Mem (MB) | Time |
---|---|---|---|
643 | 0 | 4 | 4 |
644 | 0 | 6 | 7 |
645 | 0 | 14 | 5 |
646 | 1 | 10 | 9 |
647 | 1 | 8 | 1 |
648 | 3 | 7 | 4 |
649 | 3 | 6 | 3 |
650 | 3 | 10 | 8 |
651 | 3 | 4 | 10 |
652 | 5 | 4 | 3 |