
Implementation with Map/Unmap
With this memory model, also referred to as classic memory model, a roll-in corresponds to mapping a context in the extended memory, and a roll-out corresponds to unmapping. There is an identical implementation on Linux (see Memory Management on Linux).
The following figure displays two work processes that are accessing a shared resource.

The shared resource (memory mapped file) contains all the user contexts. The extended memory of a work process contains an area reserved for mapping the current user context.
The figure displays a context change or transfer: First, the context for user x, mode y, is mapped in the extended memory of work process 1. The work process processes an inquiry of this context. Analogous to this, the context from user n, mode m is mapped in the reserved area of work process 2 (marked with a 1). After processing, both work processes "put" the (changed) context back in the shared resource by making the context visible again.
Then work process 1 can process the context for user n, mode m and work process 2 can process the context from user x, mode y (marked with a 2).
The start address for the mapped context is always the same.
Implementation of the Flat Memory Model
On Windows 64-bit, you can also use an extended memory implementation called "flat", which is identical to the standard UNIX memory model.
With the flat memory model, the extended memory uses a memory-mapped file with memory protection ( protect/unprotect).
Roll-in means removing the protection for a context in the extended memory and roll-out means protecting a context. All user contexts are always mapped in the virtual address space for each work process. At the beginning, all user contexts are protected.
To use the flat memory model, you must define the es/implementation=flat parameter in the instance profile.
The advantage of the flat memory model is the reduced number of soft page faults, because the process working set is stable. The disadvantage is the overhead of the memory protection, which results in higher kernel-mode CPU usage.
Do not use the flat memory model on systems with a small amount of memory (RAM) as the performance might suffer from hard page faults (page-ins).