Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simulation: Main Memory Allocation (Shivakant Mishra) Goal: To simulate and evaluate different memory allocation/deallocation techniques, first fit, next fit, best fit, and worst fit, when

Simulation: Main Memory Allocation (Shivakant Mishra)

Goal: To simulate and evaluate different memory allocation/deallocation techniques, first fit, next fit, best fit, and worst fit, when a linked list is used to keep track of memory usage. Assume that the memory is 256 KB and is divided into units of 2 KB each. A process may request between 3 and 10 units of memory. Your simulation consists of three components: Memory component that implements a specific allocation/deallocation technique; request generation component that generates allocation/deallocation requests; and statistics reporting component that prints out the relevant statistics. The Memory component exports the following functions: 1. int allocate_mem (int process_id, int num_units): allocates num_units units of memory to a process whose id is process_id. If successful, it returns the number of nodes traversed in the linked list. Otherwise, it returns -1. 2. int deallocate_mem (int process_id): deallocates the memory allocated to the process whose id is process_id. It returns 1, if successful, otherwise 1. 3. int fragment_count( ): returns the number of holes (fragments of sizes 1 or 2 units). You will implement a separate Memory component for each memory allocation/deallocation technique. The request generation component generates allocation and deallocation requests. For allocation requests, the component specifies the process id of the process for which memory is requested as well as the number of memory units being requested. For this simulation, assume that memory is requested for each process only once. For deallocation requests, the component specifies the process id of the process whose memory has to be deallocated. For this simulation, assume that the entire memory allocated to a process is deallocated on a deallocation request. You may generate these requests based on some specific criteria, e.g. at random or from a memory allocation/deallocation trace obtained from some source. There are three performance parameters that your simulation should calculate for all four techniques: average number of external fragments, average allocation time in terms of the average number of nodes traversed in allocation, and the percentage of times an allocation request is denied. Generate up to 10,000 requests using the request generation component, and for each request, invoke the appropriate function of the Memory component for each of the memoryallocation/deallocation technique. After every request, update the three performance parameters for each of the techniques. The statistics reporting component prints the value of the three parameters for all four techniques at the end. Submission Details You have to copy your code to MS-Word. You also have to copy results of your testing to MS-Word (copy screens)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions