Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Memory Management module in an operating system needs to perform several calculations to serve and assist the CPU. One of the recent memory management

The Memory Management module in an operating system needs to perform several calculations to serve and assist the CPU. One of the recent memory management schemes requires that available slots/partitions in the memory be tracked according to their locations in the memory, and a list of such available slots be maintained. Processes keep showing up and requesting for memory. The memory manager allocates the first available slot to a process at the front of the process queue that is big enough to accommodate the process. Any leftover portion of the slot becomes a new slot that can be allocated to some other process. The search for subsequent processes in the queue begins at the memory location that the previous allocation ended at. In the event of reaching the last memory location while searching for a slot to allocate to a waiting process, if the full memory map has not been tested for the current search, the search begins at the start of the memory map again. This algorithm is known as the next fit algorithm, which is a variant of the traditional first fit algorithm. The idea behind this project is to enable a better understanding of dynamic relocation of processes in memory based on slot availability for the students.

Learning Objectives The focus of this assignment is on the following learning objectives:

Be able to allow the memory manager to accept a list that contains the base address values for the slots and another list of displacement values from the base of the slot. The lists would, obviously be of the same size. It can be assumed that there will be no mismatch in these list sizes and there will be a one-to-one correspondence between the values

.Be able to allow the memory manager to accept a third list (finite, small size but variable and decided by the user) of process sizes.

These processes should be allocated space in the memory according to the next fit memory allocation algorithm by the memory manager and report it

Be able to keep track of the slots as the allocation proceeds and update the slot sizes after allocations

Be able to identify when a process cannot be allocated space in the slots

Be able to process the full reference string until the end of the string is reached

You are to implement a program that would solve questions like the one below:

Given the below slot locations and the process list, allocate the slots to the processes as per NextFit Algorithm.

Base/starting locations of the slots: 1200, 1700, 2550, 3220, 4245, 6450

Maximum Displacement in the slot (number of memory locations in the slot): 100, 300, 50, 200, 150, 250

The information can be visualized by the following figure:

Process list (number of memory locations the process spans, processes identified as A, B, C and so on): 40, 150, 50, 200, 50, 20, 10, 150

report the next fit allocations of the processes with their starting location and process size

report the new slot locations with the new displacements after a successful allocation

keep allocating till you exhaust the list or stop when you cannot allocate space to a process

report the situation if an allocation is not possible The list of requirements are as follows:

General requirements for the program:

The program accepts a list containing base locations (in ascending order)of any length specified by the user as user inputs. You should not assume a fixed number of base locations. These number of base locations should be variable and specified by the user.

The program accepts a list containing maximum displacement for the previously entered base locations (and hence of the same length as the list containing base locations)specified by the useras user inputs.

The program confirms the user inputs by printing the base locations and the displacements.

The program next accepts a list containing the process size in the number of locations (variable again) as specified by the user. The program confirms the user inputs by printing the list of processes with labels A, B, C and so on.

Based on the user inputs as above, the program picks entries in the process sizes, identifies if it can be allocated a slot as per the Next Fit Algorithm. If it can be allocated a slot, the memory manager program allocates it to the slot.

If the process cannot be allocated a slot, the program prints a message and stops.

If the process can be allocated a slot, the information is printed, and subsequent processes are taken up.

If the allocation was successful, the slot information is accordingly updated and is printed with the new base locations and displacement values.

The allocation process proceeds as long as it can. If it allocates slots to all the processes in the list, it prints this information.

The program should clear any dynamically allocated memory used and not leave any memory leaks before exiting.

The program should be tested on the UWF SSH server (or on the VM only if the SSH server is down) before submission and submitted with a makefile. The instructor will test the program files by only running make and make clean.

Please make sure that the makefile also contains the name of the target executable file and the command to run the target. Entering the make command on the command prompt should run the target executable file.

Ideally, for the next fit algorithm, in the event of reaching the last memory location while searching for a slot to allocate to a waiting process, if the full memory map has not been tested for the current search, the search begins at the start of the memory map again. For this project, the instructor will not be testing this feature of the next fit algorithm and will test your program only with values that can be either allocated or not allocated in one search across the memory map from the beginning to the end. So, feel free to not implement this aspect of the next fit.

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

Step: 3

blur-text-image

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago