This assignment is an exploration of memory management algorithms. A hypothetical computer, **howdy**, has a 128 MB main memory. The OS kernel is resident in the lowest order 16 MB. Processes arrive with an interarrival time that is uniformly distributed between 0 and 2000 ms. Each process
* arrives, and requests a contiguous block of memory whose size is uniformly distributed between 2 MB and 18 MB, in multiples of 1 KB.
* waits for the memory manager to allocate the memory in a contiguous block.
* once memory is allocated, is copied into memory. When m KB are in the allocated block, the copy takes m ms.
* once loaded, takes a processing time that is uniformly distributed between 100 and 1700 ms. CPU scheduling for user processes is round robin with a quantum of 50 ms and a context switch cost of 2 ms.
* once completed processing, releases the allocated memory.
1. Implement a simulation to determine
* the external fragmentation, and
* the average number of processes waiting for memory
assuming that waiting processes are processed FCFS and the memory manager operates (i) best-fit, (ii) first-fit, and (iii) worst-fit.
Design appropriate data structures for each method.
Design and conduct an appropriate set of experiments to evaluate these schemes.
Draw conclusions about their relative merits, using your experiments to justify your conclusions.
2. Modify your simulation so that waiting processes, rather than being treated FCFS, are handled using a smallest-request-first rule, i.e. if two processes are waiting, the one with the smaller memory request takes precedence. Carefully analyze how this affects fragmentation and waiting processes.
3. Based upon your experimental results, design and implement a compaction scheme. Your scheme may involve the recovery of some or all of the holes to form a larger (useful) hole. Assume that each move of 1 KB of process space takes 1 ms of time. You must determine when, and how often, compaction should be done. Explain with a clear justification using experimental results why your solution is a good one.
The CPU scheduler incorporates the OS function of compaction using preemption of the running user process. When it is determined that a compaction is to be done, it must take priority over the user process being executed.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).
## Platform
Windows XP