OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 1:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re:A bitmap based allocation technique
PostPosted: Tue Apr 27, 2004 11:21 am 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 11:33 pm
Posts: 3882
Location: Eindhoven
Must admit, I've used one of the most space-wasting overdone methods in my OS. Point is, in the end it's the clearest with most functionality.

The only thing I'm going to have to add is the NUMA way the Opterons address their memory in MP systems, they don't have to keep the memory contiguous and I plan to abuse that fact. Even that is near trivial to add:

I use a "bitmap" where each bit takes 64 bits, or 8 bytes. Each entry is identified by its address as a certain page frame, each page frame is mapped in either one address space for a process, in one address space for the paging overhead of a process, in the kernel address space as locked pages (such as the shared paging of the kernel, and pages that are explicitly locked), pages that are bad (damaged memory module support!), pages that are unchecked (again, for classifying as bad), and a few I've forgot, including kernel pages that are currently in use but that contain init code or a plain ELF of the kernel/module (so they can be freed at some point).

Each page frame also contains a number for the pid of the process that holds them (pid 0 is for non-pid-bound pages) and a virtual address where they're paged in for that process, so a page can be explicitly unmapped (which can be useful, say for <16M io space etc). They also contain a pointer to the next page of its group (group == the type of the page frame + the pid), so that pages of particular groups can be easily located (such as zeroed pages etc.) and that pages for any one process can be freed in a jiffy (just follow the links, first freeing the pages themselves, then the page tables). One of the bits in the process is used as a copy-on-write bit, so that if a page is written to when it's copy-on-write, it's duplicated. In a linked list for COW pages the count is kept, and if it ever reaches zero the page is just put as non-COW and the COW-list entry is removed.

For more details, see kernel/core/fp in 0.0.2.1 or better kernels - www.sf.net/projects/atlantisos

-- edit , it's only in 0.0.2.1 or better kernels, that's exactly what I changed from 0.0.2... ::)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 638 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group