Windows 3.11 EMS Memory Allocation Explained
This article examines how Microsoft Windows 3.11 handled memory allocation via the Expanded Memory Specification (EMS). While Windows 3.11 natively operated in protected mode using Extended Memory (XMS), it supported legacy MS-DOS software dependent on EMS by virtualizing hardware bank-switching mechanisms. Below is a detailed breakdown of how Windows 3.11 utilized 386 processor architecture, virtual device drivers, and system configuration files to allocate and manage expanded memory for applications.
The Problem: The 640 KB Conventional Memory Barrier
Early PC architecture limited MS-DOS to 640 KB of conventional memory. To bypass this restriction, the Lotus-Intel-Microsoft Expanded Memory Specification (LIM EMS) was developed.
Traditional EMS functioned through bank switching. A dedicated 64 KB
region in the Upper Memory Area (UMA)—between 640 KB and 1024 KB—served
as a "page frame." This frame was split into four 16 KB windows.
Physical memory boards swapped 16 KB segments of expanded memory into
this address window on demand, allowing DOS programs to access megabytes
of data through interrupt calls (specifically INT 67h).
386 Enhanced Mode and Virtualization
Unlike earlier versions of Windows, Windows for Workgroups 3.11 dropped support for Real Mode and Standard Mode (286 protected mode). It ran exclusively in 386 Enhanced Mode, which relied on the paging and virtualization capabilities of the Intel 80386 processor (and newer).
In 386 Enhanced Mode, Windows managed all physical memory primarily
as Extended Memory (XMS) via the HIMEM.SYS driver. To
support DOS applications that required EMS, Windows 3.11 did not rely on
physical EMS hardware expansion cards. Instead, it virtualized EMS by
leveraging the CPU's Virtual 8086 (V86) mode:
- Virtual Machines (VMs): Each MS-DOS prompt or application ran in its own isolated Virtual 8086 machine, simulating an independent 8086 environment.
- Virtual Device Drivers (VxDs): The Windows Virtual
Machine Manager (VMM), alongside the built-in virtual memory driver
(
*dosmgrand*v86mmgr), intercepted calls made toINT 67h. - Paging Simulation: When an application requested an EMS page swap, Windows did not perform hardware bank switching. Instead, it altered the 386 page tables, dynamically mapping a 4 KB or 16 KB page of extended memory into the designated page frame address space of that specific VM.
Native Windows Applications vs. DOS Applications
Windows 3.11 handled memory differently depending on whether the program was native or built for DOS:
- Native 16-bit Windows Applications: These programs ran in protected mode and did not use EMS. They allocated memory through the Windows Global and Local Memory Managers, utilizing linear extended memory directly.
- MS-DOS Applications: If a DOS application required EMS, Windows allocated it from the shared global pool of extended memory. Because the memory was allocated dynamically, unused memory reserved for EMS could be reclaimed by Windows when the DOS application was closed.
Managing EMS Allocations via PIF Files
Users and administrators managed how much expanded memory a DOS
application could consume through Program Information Files
(.PIF), edited with the Windows PIF Editor:
- EMS Memory (KB Required): The minimum amount of expanded memory required for the application to launch. If the system could not allocate this amount, Windows displayed an out-of-memory error.
- EMS Memory (KB Limit): The maximum amount of
expanded memory Windows would grant to that specific virtual machine.
Setting this value to
0prevented the application from using EMS altogether, freeing up address space in the UMA. Setting it to-1allowed the application to allocate as much expanded memory as was available.
Interaction with EMM386.EXE
Prior to starting Windows, DOS users typically loaded
EMM386.EXE in CONFIG.SYS to provide EMS memory
in real mode. When Windows 3.11 launched in 386 Enhanced Mode, it
largely bypassed the DOS-level EMS manager.
If EMM386.EXE was loaded with the NOEMS
parameter, DOS-level EMS was disabled to maximize Upper Memory Blocks
(UMBs) for drivers. However, Windows 3.11 could still provide simulated
EMS to DOS applications running inside Windows VMs, provided a page
frame location could be established within the upper memory regions.