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