Memory Object
Memory object is a conainer of page frames.
Internally, a memory object consists of two objects,
cache and
pager.
Cache holds a set of page frames. All the frames
in a memory object is recorded in the cache object.
Pager implements a mechanism to read and write pages to and from
memory and external I/O device. Pager is expected to be
subtyped. Currently, two types of pagers are provided,
Default default pager(aka bogopager)
and Real default pager(aka default
pager).
- Bogopager always provides a zero filled page on page fault.
It doesn't provide the page out operation.
Bogopager comes with the vmcore extension.
- Default pager provides a zero filled page on first fault.
It supports page-out on generic
file system.
When loaded into memory, the default pager replaces the
public procedures
to call bogopager. Thus, the bogopager and the default pager
are used in the same way.
The reason the bogopager is there is that the default pager depends on
the file system, and file system depends on vmcore. Therefore, we
can't put the default pager in vmcore, or we have circular dependency.
Pager Interface
Here is the list of mechods that all
pagers have to provide.
- init(): T;
- destroy()
- pageIn(offset: PageNumber; VAR data : ARRAY OF CHAR) : ResultCode;
- Read the contents of the page offset from the external
device. The
ResultCode is an enumerated type
whose values include the following.
- Success
- This is the normal return code.
- AlreadyPagedIn
- This indicates that the requested page to
should be in memory already. When this code is
returned, the memory object rechecks the cache object.
- AlreadyPagedOut
- This code should be returned only by
pageOut
method described below. This code indicates that the
requested page is already paged out. When the memory
object gets this code, it interprets as
Success.
- DeviceFull
- NotImplemented
- These are catastrophic event.
The memory object is immediately destroyed.
(not done now)
- pageOut(offset : PageNumber; READONLY data : ARRAY OF CHAR;
dirty: BOOLEAN) : ResultCode;
- Write the page out to the external device.