Prerequisite – Partition Allocation Methods
Static partition schemes suffer from the limitation of having the fixed number of active processes and the usage of space may also not be optimal. The buddy system is a memory allocation and management algorithm that manages memory in power of two increments. Assume the memory size is 2U, suppose a size of S is required.
- If 2U-1<S<=2U: Allocate the whole block
- Else: Recursively divide the block equally and test the condition at each time, when it satisfies, alloacate the block and get out the loop.
System also keep the record of all the unallocated blocks each and can merge these different size blocks to make one big chunk.
- Easy to implement a buddy system
- Allocates block of correct size
- It is easy to merge adjacent holes
- Fast to allocate memory and de-allocating memory
- It requires all allocation unit to be powers of two
- It leads to internal fragmentation
Consider a system having buddy system with physical address space 128 KB.Calculate the size of partition for 18 KB process.
So, size of partition for 18 KB process = 32 KB. It divides by 2, till possible to get minimum block to fit 18 KB.
- Different Types of RAM (Random Access Memory )
- Operating System | Swap Space
- Allocating kernel memory (buddy system and slab system)
- Operating System | Page Table Entries
- Operating System | Memory management - mapping virtual address to physical addresses
- Tracing memory usage in Linux
- Zombie Processes and their Prevention
- Virtual Memory | Operating System
- Operating System | Segmentation
- Last Minute Notes – Operating Systems
- Operating System | Paging
- Operating System | Thread
- Operating System | Memory Management |Partition Allocation Method
- Static and Dynamic Libraries | Set 1
- Operating System | Critical Section
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.