Extended Memory

As mentioned previously, the memory map on a system based on the 286 or higher processor can extend beyond the 1MB boundary that exists when the processor is in real mode.

On a 286 or 386SX system, the extended memory limit is 16MB (16-bit addressing); on a 386DX, 486, Pentium, Pentium MMX, or Pentium Pro system, the extended memory limit is 4GB (4,096MB, using 32-bit addressing). Systems based on the Pentium II and newer processors have a limit of 64GB (65,536MB, using 36-bit addressing).

For a system to address memory beyond the first megabyte, the processor must be in protected mode—the native mode of 286 and higher processors.

On a 286, only programs designed to run in protected mode can take advantage of extended memory; 386 and higher processors offer another mode, called virtual real mode, which enables extended memory to be, in effect, chopped into 1MB pieces (each its own real-mode session).

Virtual real mode also enables several of these sessions to be running simultaneously in protected areas of memory. They can be seen as DOS prompt sessions or windows within Windows 9x/Me, NT, 2000, XP, or OS/2.

Although several DOS programs can be running at once, each is still limited to a maximum of 640KB of memory because each session simulates a real-mode environment, right down to the BIOS and Upper Memory Area.

Running several programs at once in virtual real mode, called multitasking, requires software that can manage each program and keep them from crashing into one another. OS/2; Windows 9x/Me; and Windows NT, 2000, and XP all do this.

The 286 and higher CPU chips also run in what is termed real mode, which enables full compatibility with the 8088 CPU chip installed on the PC/XT-type computer. Real mode enables you to run DOS programs one at a time on an AT-type system just as you would on a PC/XT.

However, an AT-type system running in real mode, particularly a system based on the 386 through Pentium 4 or Athlon, is really functioning as little more than a turbo PC. In real mode, these processors can emulate the 8086 or 8088, but they can't operate in protected mode at the same time.

For that reason, the 386 and above also provide a virtual real mode that operates under protected mode. This enables real-mode programs to execute under the control of a protected-mode operating system, such as Win9x/Me or NT/2000/XP.

XMS Memory

Microsoft, Intel, AST Corp., and Lotus Development developed the extended memory specification (XMS) in 1987 to specify how programs would use extended memory. The XMS specification functions on systems based on the 286 or higher and enables real-mode programs (those designed to run in DOS) to use extended memory and another block of memory usually out of the reach of DOS.

Before XMS, there was no way to ensure cooperation between programs that switched the processor into protected mode and used extended memory. There was also no way for one program to know what another had been doing with the extended memory because none of them could see that memory while in real mode.

HIMEM.SYS becomes an arbitrator of sorts that first grabs all the extended memory for itself and then doles it out to programs that know the XMS protocols. In this manner, several programs that use XMS memory can operate together under DOS on the same system, switching the processor into and out of protected mode to access the memory.

XMS rules prevent one program from accessing memory that another has in use. Because Windows 3.x is a program manager that switches the system to and from protected mode in running several programs at once, it has been set up to require XMS memory to function.

Windows 9x/Me operates mostly in protected mode, but still calls on real mode for access to many system components. Windows NT, 2000, and XP are true protected-mode operating systems, as is OS/2. Extended memory can be made to conform to the XMS specification by installing a device driver in the CONFIG.SYS file.

The most common XMS driver is HIMEM.SYS, which is included with Windows 3.x and later versions of DOS, starting with 4.0 and up. Windows 9x/Me and NT/2000/XP automatically allow XMS functions in DOS prompt sessions, and you can configure full-blown DOS-mode sessions to allow XMS functions as well.