[FreeVMS] pager question
Guido
guidoj at users.sourceforge.net
Fri Jun 28 20:59:45 CEST 2013
Hi all,
Looking at the pager algorithm I noticed that a page fault in user space could
lead to allocation of a new page for the process that generated the page
fault. Maybe I'm missing something, but it seems to me that that is not
desired behavior. Buggy or malicious software in user space should not be able
to acquire resources simply by accessing invalid memory addresses. In stead
this should lead to an access violation and termination of the originating
process.
I'd suggest that page fault handling and mapping/granting memory are entirely
separate functions. A page fault on a page that is not mapped is an access
violation and should lead to termination of the originating process. If the
page is mapped, the pager could (like OpenVMS does) distinguish between soft
and hard page faults. A soft page fault means that the page still resides
somewhere in cache, while a hard page fault means it is swapped out and has to
be loaded from disk. This depends on the paging algorithm.
Memory allocation and mapping/granting pages is something completely different.
My suggestion would be that allocation requests by user tasks are handled by
the task pager. If the task pager runs out of memory it can request one or
more pages from the main pager through a page request system call. The main
pager can map/grant a page from the free page pool it maintains or, if the
pool is empty, it can request a new page from the kernel. If the kernel runs
out of free pages, the pager should free up some pages by swapping out some
pages to disk. Note that this could (should?) be optimised by initially
mapping/granting all free pages to the main pager, so that the pager does not
have to use system calls to request memory from the kernel once the system is
up and running.
I could be wrong, of course ...
Regards,
Guido
More information about the FreeVMS
mailing list