Segmented Paging and Buddy System

Segmented Paging 

To take the advantages of best features of paging and segmentation, we combined both that is known as segmented paging. That means, we combined fixed sized pages within variable sized segments. There are some advantages of segmented paging that are memory uses reduced. There is external fragmentation, however, internal fragmentation still possible. The size of page table is limited by segment size, however page table still need to be contiguous. Segment table has only one entry per segment. Each segment has a its own page table. Average size of segments are greater than average page size. The virtual address contains segment number and offset. Each offset contains page number and page offset. In other words, virtual address contains segment number, page number and page offset.




Buddy System

When we used fixed partition schemes that may suffers from segmentation. In other words, usages of space may not be optimal. So, we use a memory allocation technique that divides memory into partitions to try to satisfy a memory request as suitably as possible. This technique is called Buddy system that recursively divide the block equally and test the condition at each time; when it satisfies, allocated the block and get out of the loop. Buddy system is easy to implement and allocates block of correct size. Buddy system is fast and best memory allocation technique. However, there is still suffers from internal fragmentation and it requires every allocation units to be power of two.