VDM Address Space Management

At initialization, each VDM has a linear address space of 4MB, because a single page table is assigned for each VDM. The page table itself is a single 4KB page, and can hold a maximum of 1024 page table entries. Each of these entries is a doubleword and points to a page with a size of 4KB, hence the 4MB size of the initial address space. The size of the address space can be expanded beyond 4MB if required; for instance, an application running in the VDM may request the allocation of a large amount of expanded memory, in which case the VDMM will allocate the memory as needed.

Note that when memory is allocated OS/2 V2.0 merely reserves a linear address range. The range is not backed by physical memory until the memory is committed. Memory may not actually be committed until a later time, and it may be committed in portions. Allocation without commitment does not use any physical memory and therefore does not waste resources.

A typical VDM address space map is shown in Figure "Typical VDM Address Space Map".

Each VDM task executes in the first megabyte of the linear address space, thereby allowing the physical addresses used within the DOS applications to be mapped directly to the process address space of the VDM. DOS system areas such as the ROM BIOS area and the Interrupt Vector table, are mapped from physical memory into the VDM's address space by the virtual device driver VBIOS.SYS.

Page 0 contains, for example, the ROM BIOS area, the Interrupt Vector table, and the DOS communication area. ROM areas used by hardware devices are mapped by the virtual device drivers into the linear address space of the VDM. The same applies to other linear memory objects, such as EMS objects and display memory.

A virtual device driver uses the VDHQueryFreePages() device helper service to find a region where no memory in the linear address space has been allocated or mapped. If a free region is found, the VDHReservePages() service is used to reserve the memory region. Mapping cannot take place where memory has already been allocated. On the other hand, memory may not be allocated where mappings already exist. The operating system's memory manager takes care of this. Page faults are generated if a process attempts to access memory which has previously been invalidated because it was unmapped, or if the page has been swapped out to disk.

The 64KB memory area above 1MB (also known as the high memory area) must be treated in a special way. This is described in further detail in A20 Line Service (64KB Wraparound) and in High Memory Area (HMA).


[Back: Virtual DOS Machine Manager (VDMM)]
[Next: VDM Creation]