Open In App

Buddy System – Memory Allocation Technique

Static partition techniques are limited by having a fixed number of active processes, and space use may not be optimal. The buddy system is a memory allocation and management technique that uses power-of-two increments. Assume the memory size is 2U and a size of S is required. In this article, we are going to discuss the Buddy System in detail along with examples, advantages, disadvantages, etc.

What is the Buddy System?

Buddy System is a memory allocation technique used in computer OS to allocate and manage memory efficiently. This technique by 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.



The Buddy System is a reminiscence control method utilized in working systems to allocate memory dynamically. It is by and large applied in systems wherein reminiscence is allocated and deallocated frequently, inclusive in multitasking environments or structures with varying memory demands. In the Buddy System, the memory is split into fixed-length blocks, regularly in powers of (e.g., 1KB, 2KB, 4KB, and so on.). When a request for memory allocation is made, the device seems for the correct-sized block. If an appropriate block is determined, it’s far allocated to the inquiring manner. However, if the asked size doesn’t shape any existing block precisely, the device allocates a bigger block after which splits it into smaller blocks till an accurately sized one is received.

Algorithm of Buddy System Memory Allocation Technique

Below are the steps involved in the Buddy System Memory Allocation Technique:



The Buddy System technique has several advantages, including efficient use of memory, reduced fragmentation, and fast allocation and deallocation of memory blocks. However, it also has some drawbacks, such as internal fragmentation, where a block may be larger than what the process requires, leading to a waste of memory. Overall, the Buddy System is a useful memory allocation technique in operating systems, particularly for embedded systems with limited memory.

The system also keeps a record of all the unallocated blocks and can merge these different-sized blocks to make one big chunk.

Types of Buddy System

The Buddy System in memory control generally refers to a selected method used to allocate and deallocate memory blocks. However, within this framework, versions or adaptations may additionally exist relying on specific necessities or optimizations wished for distinctive structures. Here are a few types of Buddy Systems:

Features of Buddy System

Advantages of Buddy System

Disadvantages of Buddy System

Example of Buddy system

Consider a system having buddy system with physical address space 128 KB.Calculate the size of partition for 18 KB process.

Solution: So, size of partition for 18 KB process = 32 KB. It divides by 2, till possible to get minimum block to fit 18 KB.

Frequently Asked Question on Buddy System – FAQs

How does the Buddy System work?

In the Buddy System, memory is split into constant-size blocks. When a reminiscence allocation request is made, the system searches for the ideal-sized block. If an actual match is discovered, the block is allotted. Otherwise, a bigger block is cut up into smaller “friend” blocks till an accurately sized one is acquired. When reminiscence is deallocated, the system merges adjacent loose blocks back into larger blocks to reduce fragmentation.

What are the advantages of the Buddy System?

Some advantages of the Buddy System encompass decreased fragmentation, efficient reminiscence allocation and deallocation, scalability with increasing reminiscence demands, and comparatively easy implementation as compared to more complicated reminiscence management techniques.

Where is the Buddy System used?

The Buddy System is normally used in running structures, mainly in environments wherein memory is allotted and deallocated frequently, including multitasking structures or structures with varying memory needs. It is frequently hired in reminiscence allocators, which includes the pal allocator in the Linux kernel.


Article Tags :