Mr Nice Guy auto allocation

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
Gizmo
Member
Member
Posts: 41
Joined: Fri Aug 03, 2007 3:41 am

Mr Nice Guy auto allocation

Post by Gizmo »

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.
Aali
Member
Member
Posts: 58
Joined: Sat Apr 14, 2007 12:13 pm

Post by Aali »

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