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.