Buddy memory allocation

The buddy memory management refers to the buddy method according to Donald Ervin Knuth, a technique for allocating memory to processes. It is characterized in particular by its simplicity and easy to implement.

Function

The memory is divided into portions of length 2k. Initially, there is only one block covering the entire memory as possible; if the amount of memory can not be expressed as a power of two, it may be several blocks of different sizes. Now calls for a process a certain amount of memory, so a power of two is rounded up to the next higher and sought a corresponding block. If there is no block that size, according to a double size block is searched for, which is then divided into two halves (or buddies), and one of these blocks is assigned to the process. Are there no block double size, a block size of four times is searched, etc. As soon as memory is freed, it is checked whether caused by two buddies sharing the same size can be re- combined to form a larger block.

Criticism

The advantage of this storage management is the easy implementability and requires no special hardware support, as is the case for example, when the current paging operating systems.

Drawback is that it can be used both for internal as well as to external fragmentation.

Extensions

An extension is the weighted buddy memory management dar. this is not always shared in the ratio 1:1, but for example in the ratio 1:3, the second branch is then divided in the ratio 1:2. This results in more diverse Buddy sizes. But the administrative burden is higher and the address computation is difficult.

151853
de