In C please Objective: To simulate memory allocation with hole-fitting algorithms (First-fit, Best-fit) and implement de
Posted: Wed Apr 27, 2022 3:29 pm
In C please
Objective:
To simulate memory allocation with hole-fitting algorithms
(First-fit, Best-fit) and implement deallocation and
defragmentation of memory blocks.
Specification:
The program simulates memory allocation with a chosen
hole-fitting algorithm (First-fit, Best-fit) and implements
deallocation and defragmentation. A menu controls the operations,
and each choice calls the appropriate procedure, where the choices
are:
Sample output Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 1 Enter size of physical memory: 1024 Enter hole-fitting algorithm (0=first fit, l=best_fit): 1 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 0 Enter block size: 128 ID Start End 0 0 128 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 1 Enter block size: 320 ID Start End 0 1 0 128 128 448 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 2 Enter block size: 224 ID Start End 0 1 2 0 128 448 128 448 672 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 3 Enter block size: 288
Objective:
To simulate memory allocation with hole-fitting algorithms
(First-fit, Best-fit) and implement deallocation and
defragmentation of memory blocks.
Specification:
The program simulates memory allocation with a chosen
hole-fitting algorithm (First-fit, Best-fit) and implements
deallocation and defragmentation. A menu controls the operations,
and each choice calls the appropriate procedure, where the choices
are:
Sample output Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 1 Enter size of physical memory: 1024 Enter hole-fitting algorithm (0=first fit, l=best_fit): 1 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 0 Enter block size: 128 ID Start End 0 0 128 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 1 Enter block size: 320 ID Start End 0 1 0 128 128 448 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 2 Enter block size: 224 ID Start End 0 1 2 0 128 448 128 448 672 Memory allocation 1) Enter parameters 2) Allocate memory for block 3) Deallocate memory for block 4) Defragment memory 5) Quit program Enter selection: 2 Enter block id: 3 Enter block size: 288