Both of these techniques are good for page allocators. In other words, a large granularity allocater the usually allocates blocks only of one size -- the size imposed by the paging hardware (4kb (or 4mb) on x86 CPUs).
A bitmap allocate creates a bitmap that contains 1 bit for each page on the system. If the bit is set, the page is allocated, otherwise it's free.
A linked list allocator would contain a list containing pointers to all pages. When a page is allocated, it's removed from the free list (and potentially also added to an allocated list).
A faster alternative to a linked list, in this case, would be a stack. When you want to allocate a page, simply pop it off the free stack, and push it onto the allocated stack. If these two stacks grow in opposite directions they can even be made to occupy the same ammount of memory and allocating a page could be as fast as incrementing/decrementing a pointer/index into this memory stack:
Code: Select all
-----------------------
| |
| Free Memory Pages |
| |
| |
| ---------------------| <--- boundary index/pointer
| |
| Allocated Memory Pgs |
| |
| |
| |
| |
| |
| |
-----------------------
--Jeff