Consider a system with 1MB of available memory and requests
Consider a system with 1MB of available memory and requests for 42KB, 396KB, 10KB, and 28KB. The system is using Buddy Allocation Algorithm. Show the amount of memory allocated for each request and the state of memory after each request. Assume there is no memory release. Why does internal fragmentation occur with buddy allocation? How much internal fragmentation exists in this scenario? Why does external fragmentation occur with buddy allocation? How much external fragmentation exists in this scenario?
Solution
Consider system with 1MB of available memory and requests for 42KB, 396KB, 10KB, and 28KB. The system is using buddy allocation algorithm.
As we know that External fragmentation is left out or wasted memory which is noticeable to the system exterior of the requesting processes.
In buddy allocation External fragmentation usually occurs because most of the requests are not of same size thus, the memory request is not satisfied, still when there is sufficient total free memory in the system.
The external fragmentation exists in this scenario is:
16 + 128 + 256 = 400KB
total of fragmentation and the allocated memory should equal 1MB:
148KB + 400KB + 42KB + 396KB + 10KB +28KB
= 1024KB
= 1MB
