allocate pages

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mr. x

allocate pages

Post 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?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:allocate pages

Post 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 ...
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:allocate pages

Post 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
Post Reply