Memory Mapping

Memory mapping of files and other resources, and paging more generally, needs to take into consideration the following requirements:

Pagers

Pagers are involved in memory mapping to provide the memory pages that appear within the memory areas exposing portions of resources. They rely on collections of pages so that they may supply populated pages. To populate pages, pagers employ accessors which have the necessary knowledge to obtain data for a particular resource.

pagersMapped file regionPagerPagerPage collectionPage #2(exposed)Page #2Page #2Page #3Page #1Page #2Page #3...

Page Collections

A page collection is an area of virtual memory backed by physical memory that is made available for files and other resources. Pages are allocated to files on request, with allocation occurring only if no existing allocated pages happen to satisfy a given map request.

Once allocated, pages are populated by pagers, and page details are sent as map items to tasks needing to access them. When pages are no longer needed, they are flushed and invalidated.

When no free pages are available to satisfy a request, an existing page will be flushed and recycled for the new request.

Accessors

Accessors provide the functionality needed by pagers to populate pages with the data requested from within a region of a resource. Two operations are supported for handling data with flexpages:

These operations depend on specific implementations of the following operations:

Since each accessor operates within the context of a particular file, concurrency control is likely to be enforced at this level to prevent competing concurrent accesses to the filesystem data representing the file.

Resources

Filesystem objects are provided using file resource abstractions, with memory-mapped objects employing a generic mapped file resource abstraction in combination with a filesystem-specific accessor and a generic page collection.

pagingResourceMappedFileObjectPagerSyncSupportAccessorQueueFileResourceBaseFileAccessorMappedFileResourcePagingAccessorPagingPages