Virtual Memory Management

The virtual address space is split into two regions:

  • System Region

    This is the region above the 512MB, which is only accessible to tasks running at operating system privilege level.

  • Process Region

    This is the first 512MB of the virtual address and only memory objects in this region are mapped into a process's address space when that process is running at user privilege level. Each process present in the system has its own mapping of this region. The process region is further split into:

    In order to manage virtual memory, OS/2 V2.0 uses the concept of an arena. There are three arena types in the system:

  • The system arena

  • The shared arena

  • Per-process private arenas.

    Associated with each arena is the virtual address space, which it maps. The system arena contains all the memory objects that are in the system region. It maps the virtual address space between 512MB and 4GB. The shared arena describes all the shared memory objects in the process region.

    Each process has its own private arena, which contains EXE code and the process's private data. The private arena starts at the lowest address of the process region's virtual address space and has a minimum size of 64MB. A program loaded into the address space will be loaded at the low end of the address space. Because of this, a particular EXE will always occupy the same range of addresses. If a program is used by more than one process it is possible to share one copy of the program code.

    The shared arena is allocated starting at the top end of the process region and moves down towards the private arena. It has a minimum size of 64MB. The upper limit of the private arena and the lower limit of the shared move towards one another. Each object in the shared arena is allocated its own linear address range. It will have the same address range in each of the process address spaces, into which it is mapped.

    Each process has its own address space, which maps memory objects in the process's private arena and the shared arena. Only those objects in the shared arena, which a process requires access to and is authorized to access, will be mapped into the process's address space.

    Figure "Process Address Space Layout"

    Both private and shared storage for memory objects may be allocated within each arena. For example, DLL instance data is located within the shared memory arena, but each instance of the data uses a separate memory object in order to preserve data integrity, and hence each memory object is treated as private storage. Although separate memory objects, they each map to the same range of addresses in the shared arena. Table "Memory Object Classes" shows the types of storage (private or shared) available within each memory arena, and the uses to which these types of storage may be put by applications.

    Private storage in the private arena is used for read/write data, allocated at either loadtime or runtime, which is accessed only by a single process. Shared storage in the private arena is used for executable code, which may be shared between processes.

    Shared storage in the shared arena is used for DLL code and read-only data, as well as DLL read/write data, which is not instance-specific. Such objects may be accessed by all processes in the system. Private storage in the shared arena is used for DLL instance data, which is unique to each process accessing the DLL.

    For a more detailed discussion of the process of virtual memory management, readers should refer to The Design of OS/2.


    [Back: Guard Page Technique]
    [Next: Page Attributes]