OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:46 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Mr Nice Guy auto allocation
PostPosted: Fri Aug 10, 2007 5:11 pm 
Offline
Member
Member

Joined: Fri Aug 03, 2007 3:41 am
Posts: 41
In most operating systems that implement memory management, if you attempt to access memory at a location you haven't asked the os to set aside for you (allocate) you get some kind of fatal error.

My proposal is a system where accessing pages that haven't had the present bit set will automatically allocate a page inside of the page fault handler routine. But unlike pages that are allocated the politcally correct way (malloc for example) pages that are allocated to cover the mistakes of a ill designed userland program have a 2 bit timer in intervals of seconds so that after 3 seconds the page is set not present and ready to be used again. If a process gets memory leak happy and references way too many pointers that point to pages not allocated yet it will be terminated and the option to disable automatic allocating will be there for debugging.

Maybe if the default way for allocating pages was automatic (the application simply uses an address not allocated yet and the page is allocated) instead of having to make system calls it would be a possible performance gain or at least a simplified way to grant pages to programs.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 10, 2007 5:59 pm 
Offline
Member
Member

Joined: Sat Apr 14, 2007 12:13 pm
Posts: 58
Most modern OS's already allocate pages on-demand within certain areas.

As for the other idea for reducing fatal errors, DONT. No really, i mean it, don't do that. If something goes wrong you want the system to detect it as soon as possible and end the program to avoid possible data corruption.

This could only promote even sloppier programming practices and 'hide' bugs that would have been obvious otherwise. Not to mention the potential for a program to accidentally wipe all your files just because the OS didn't end it in time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 29 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