An advantage of the buddy system is how quickly adjacent buddies can be combined to form larger segments using a technique known as coalescing.
In Figure 9.26, for example, when the kernel releases the CL unit it was allocated, the system can coalesce CL and CR into a 64-KB segment. This segment, BL ,can in turn be coalesced with its buddy BR to form a 128-KB segment. Ultimately, we can end up with the original 256-KB segment.
The obvious drawback to the buddy system is that rounding up to the next highest power of 2 is very likely to cause fragmentation within allocated segments.
For example, a 33-KB request can only be satisfied with a 64KB segment. In fact, we cannot guarantee that less than 50 percent of the allocated unit will be wasted due to internal fragmentation.
In the following section, we explore a memory allocation scheme where no space is lost due to fragmentation.
9.8