0% found this document useful (0 votes)
147 views

Algorithm For MMU Programs

The document describes algorithms for implementing three different memory management schemes: first-fit, best-fit, and worst-fit. Each algorithm involves getting process and memory block details, checking blocks for size and availability, assigning processes to blocks that are large enough and unassigned, and displaying the results. The algorithms differ in whether they assign processes to the first block found that fits (first-fit), the smallest block that fits (best-fit), or the largest block that fits (worst-fit).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views

Algorithm For MMU Programs

The document describes algorithms for implementing three different memory management schemes: first-fit, best-fit, and worst-fit. Each algorithm involves getting process and memory block details, checking blocks for size and availability, assigning processes to blocks that are large enough and unassigned, and displaying the results. The algorithms differ in whether they assign processes to the first block found that fits (first-fit), the smallest block that fits (best-fit), or the largest block that fits (worst-fit).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

IMPLEMENTATION OF MEMORY MANAGEMENT SCHEME

FIST FIT ALGORITHM


AIM:

To write a program to implement the first-fit memory allocation algorithm.

ALGORITHM:

Step 1: Include the required header files and initialize all required variables.

Step 2: Get the number of process and memory required for each process.

Step 3: Get the number of blocks available and memory capacity of each block.

Step 4: For every process, check the block size and status of each block.

Step 5: If the block is not assigned to any process and it is capable to hold the process.
Then assign that memory block to the process and change the status of the
memory block.

Step 6: Repeat the steps 4 and 5 until all processes or memory blocks has allotted.

Step 7: Display the process memory block allocation details and also display the non-
allocated processes and non-allotted blocks.
IMPLEMENTATION OF MEMORY MANAGEMENT SCHEME

BEST FIT ALGORITHM


AIM:

To write a program to implement the best-fit memory allocation algorithm.

ALGORITHM:

Step 1: Include the required header files and initialize all required variables.

Step 2: Get the number of process and memory required for each process.

Step 3: Get the number of blocks available and memory capacity of each block.

Step 4: Sort the processes based on memory requirement in ascending order.

Step 5: Sort the memory blocks based on capacity in ascending order.

Step 6: For every process, check the block size and status of each block.

Step 7: If the block is not assigned to any process and it is capable to hold the process.
Then assign that memory block to the process and change the status of the
memory block.

Step 8: Repeat the steps 6 and 7 until all processes or memory blocks has allotted.

Step 9: Display the process memory block allocation details and also display the non-
allocated processes and non-allotted blocks.
IMPLEMENTATION OF MEMORY MANAGEMENT SCHEME

WORST FIT ALGORITHM


AIM:

To write a program to implement the worst-fit memory allocation algorithm.

ALGORITHM:

Step 1: Include the required header files and initialize all required variables.

Step 2: Get the number of process and memory required for each process.

Step 3: Get the number of blocks available and memory capacity of each block.

Step 4: Sort the memory blocks based on capacity in descending order.

Step 5: For every process, check the block size and status of each block.

Step 6: If the block is not assigned to any process and it is capable to hold the process.
Then assign that memory block to the process and change the status of the
memory block.

Step 7: Repeat the steps 5 and 6 until all processes or memory blocks has allotted.

Step 8: Display the process memory block allocation details and also display the non-
allocated processes and non-allotted blocks.

You might also like