Buddy System
The buddy system is based on dividing the memory into fixed-size blocks, and whenever a process requests memory, the system finds the smallest available block that can accommodate the requested memory size.
- Entire space available is treated as a single block of
- If a request of size such that then the entire block will be allocated
- Otherwise the block is split into two equal sized buddies
- Process continues until smallest block greater than or equal to is generated
It's not that complicated
Split memory into 2, until splitting more would not fit.
Pseudocode
Resources
We can represent this as a tree: