4.3 Memory Management
4.3.1 Memory types
The operating system that runs the computer uses physical memory (RAM), also known as system memory, and virtual memory. The four categories of system memory in the operating system include conventional, upper/expanded, high, and extended memory. Beyond the terms Dynamic Random Access Memory (DRAM) and Read Only Memory (ROM), discussed in previous chapters, it is important to understand how memory is divided into its logical types.

The logical divisions or categories of memory are the result of MS-DOS and early microprocessors, all associated with the early IBM PC, having been designed to address only a maximum of 1 MB of memory space. This 1 MB of memory was further split into two chunks. The first 640KB was used for user and OS, and the upper 384KB was used for BIOS and utilities. Windows 9x, because it is basically built on an MS-DOS foundation, supports the different types of physical memory specifications that result from the design of the original IBM PC and its many descendants. These physical memory specifications are discussed in this section, while virtual memory is discussed in a later section, under "Other types of memory".

Conventional Memory
Conventional memory includes all memory addresses between 0 and 640KB. It is also known as base memory. This is the area where MS-DOS programs normally run. In older DOS machines, this is the only memory available for running the OS files, application programs, memory resident routines, and device drivers. Memory-resident routines include Terminate-and-Stay-Resident (TSR) Programs such as mouse and CD-ROM drivers.

Upper Memory/Expanded Memory
Also known as Reserved Memory, upper memory includes memory addresses that fall between 640KB and 1024KB (1MB). It follows conventional memory and has a size of 384KB. Upper memory is available in the form of Upper Memory Blocks (UMBs). Programs that run here include system BIOS, plug and play BIOS, video BIOS and video RAM. Depending on the system, between 96KB and 160KB of this memory space is not in use by hardware, but these addresses are only available if an appropriate memory manager such as Emm386.EXE is installed during the startup process.

Closely related to Upper Memory is another memory area known as Expanded Memory. It is also called the Expanded Memory Specification (EMS). This is memory that can be accessed in pages (16KB chunks) from a 64KB page frame, established in unused UMBs. As mentioned earlier, the primary device driver that allows the use of EMS is the Emm386.EXE. This program frees up conventional memory by allowing unused portions of the reserved memory area to be used for DOS drivers and memory resident routines.

Extended Memory
With the advent of the 80286 microprocessor and its protected operating mode, it became possible to access physical memory locations beyond the 1 MB limit of the 8088/8086. Memory above this address is generally referred to as Extended Memory. This area of memory is also called Extended Memory Specification (XMS). XMS is the primary memory area used by Windows 9x. A device driver that is loaded by the OS controls this memory area. Windows 9x loads the XMS driver called Himem.sys during startup. Once loaded, Himem.sys makes extended memory available to the Windows 9x and other compatible MS-DOS programs.

High Memory
As mentioned earlier, once the XMS driver is loaded, extended memory becomes available to the OS. When this happens, the first 64KB of extended memory is called the High Memory Area (HMA). Typically, the XMS driver (Himem.sys) activates the DOS=HIGH option, enabling it to copy the MS-DOS kernel used by Windows 9x into the HMA. The point therefore, is that DOS uses the HMA, and by doing so, frees up more conventional memory for use by applications.