Explain Buddy System

Q1. What is Buddy System?

Ans. The buddy system allocates memory from a fixed size segment consisting of physically contiguous pages. Memory is allocated from this segment using a power-of-2 allocator,

  1. Which satisfies requests in units sized as a power of 2.

For example:

4 KB, 8 KB, 16 KB, and so forth.

  1. A request in units not appropriately sized is rounded up to the next highest power of 2.

For example:

If a request for 11 KB is made, it is satisfied with a 16-KB segment.

  1. When smaller allocation needed than is available, current segment split into two buddies of next lower power of two, continue until appropriate sized segment available.

For example:

When kernel request 21 KB of memory.

Buddy System Allocation

Figure: Buddy system allocation


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s