Problem of Current Buddy System.

-Repetitive coalescing and splitting of buffers.
-It is cause of performance degradation.

=> So, To avoid unnecessary coalescing and splitting,

Lazy Buddy System defers coalescing until it seems likely it is needed. and then coalesces as many blocks as possible.

So We can imporve a performance of allocate memory.


There is a 5 parameter.
N, A, G, L, D.
N(i) : current number of blocks of size 2^i

A(i) : current number of blocks of size 2^i that are allocated

G(i) : current number of blocks of size 2^i that are globally free

L(i) : current number of blocks of size 2^i that are locally free

D(i) : It is called that " slack ". Is is use to decide coalscing buffers

D = A - L OR =N -2*L - G

Caution! - The status of Free In bitmap is Globally Free.

Main Algorithm

In Request Allocate

If there is any free blocks

if block is locally free

Then D = D + 2;

else   D = D + 1;

else First get two blocks by splitting a larger one into two. and Do that allocate one and mark the locally free

In Request Free

There is a 3 cases.

1. D >=2

D = D -2; and Free block is mark Locally Free

2. D = 1

D = D -1; and Free block is makr Globally Free and, Coalesce if Possible.

3. D = 0

D = 0; and Free block is makr Globally Free and, one of locally Free block is makred Globally Free then it is free Globally ,and Coalesce if Possible.

+ Recent posts