Page 1 of 1
allocate pages
Posted: Thu Feb 26, 2004 9:49 pm
by mr. x
I'm wondering how I should allocate pages.
Should I keep a record right after my kernel with all free pages (a bit field, one bit per page), and check it for free pages?
Re:allocate pages
Posted: Fri Feb 27, 2004 3:47 am
by Pype.Clicker
You're of course talking about 'physical' page allocations (vs virtual addresses allocation) ... I think one of Tim's tutorial talk about this.
that's one of the possible techniques. The other one include creating a stack or list of free pages. They take more space, but can return a free frame in constant time -- a thing sweeping a bitmap can hardly achieve ...
Re:allocate pages
Posted: Fri Feb 27, 2004 3:57 am
by Candy
Pype.Clicker wrote:
that's one of the possible techniques. The other one include creating a stack or list of free pages. They take more space, but can return a free frame in constant time -- a thing sweeping a bitmap can hardly achieve ...
You can also combine both (a bitmap with a freelist-like structure for the free ones), or keep a permanent database (like a bitmap in size constantness) with internal linked lists for the types of pages (like a linked list). In my implementation (proud of it) it even links user mapped pages together so deleting a pid is freeing all pages in the list for that pid. Makes keeping track of all the stuff a lot easier, imo