How Windows 3.11 Managed Virtual Memory Swap Files

Microsoft Windows 3.11 utilized 386 Enhanced Mode to overcome physical RAM constraints, implementing virtual memory through paging via disk-based swap files. By leveraging the memory management unit (MMU) of Intel 80386 and later processors, the operating system treated disk space as an extension of physical memory. This article explains how Windows 3.11 managed virtual memory, the technical differences between permanent and temporary swap files, and how 32-bit access mechanisms optimized memory performance.

The Role of 386 Enhanced Mode

Windows 3.11 relied on "386 Enhanced Mode" to enable virtual memory. In this mode, the Windows Virtual Memory Manager (VMM) operated the processor in protected mode, dividing memory into fixed 4-kilobyte pages.

When running applications demanded more RAM than physically installed on the system, the VMM analyzed memory usage using a Least Recently Used (LRU) algorithm. The VMM copied inactive 4 KB memory pages from physical RAM onto the hard drive, freeing up RAM for active tasks. If an application later requested data residing in a swapped-out page, the CPU generated a page fault, prompting the VMM to read the page back from the disk and swap out a different inactive page.

Permanent vs. Temporary Swap Files

Windows 3.11 provided two distinct mechanisms for disk swapping: permanent swap files and temporary swap files. Users configured these through the Virtual Memory dialog within the Control Panel’s "386 Enhanced" settings.

Permanent Swap Files (PSF)

A permanent swap file consisted of a hidden, contiguous block of disk space assigned the filename 386SPART.PAR. Because the file was completely unfragmented, Windows recorded the physical sector locations on the disk directly into a pointer file named SPART.PAR.

Key characteristics of the permanent swap file included:

  • High Performance: Because the file was contiguous, the read/write heads did not need to seek across disparate platter locations, minimizing disk latency.
  • Direct Hardware Access: Windows could bypass MS-DOS and the system BIOS entirely when accessing a permanent swap file, addressing the hard disk controller directly.
  • Fixed Space Allocation: The disk space reserved for a permanent swap file remained unavailable to MS-DOS or other files, even when Windows was not running.

Temporary Swap Files (TSF)

A temporary swap file, named WIN386.SWP, was dynamically created in the Windows directory (or a user-specified path) when Windows started and deleted upon exit.

Key characteristics of the temporary swap file included:

  • Storage Flexibility: It could occupy non-contiguous clusters across a fragmented drive, allowing systems with limited continuous free space to utilize virtual memory.
  • Dynamic Sizing: The file grew or shrank depending on immediate application demand, returning disk space to DOS once Windows shut down.
  • Performance Penalty: Because the file was fragmented and non-contiguous, Windows had to route file I/O operations through MS-DOS (INT 21h) and BIOS (INT 13h) routines, resulting in higher CPU overhead and slower access times.

32-Bit Disk and File Access

The primary bottleneck of Windows 3.11 virtual memory was disk I/O latency. To mitigate this, Windows 3.11 introduced performance layers that significantly improved swap file throughput:

  1. 32-Bit Disk Access (FastDisk): Enabled primarily for Western Digital-compatible (WD1003) controllers, this VxD (Virtual Device Driver) bypassed real-mode BIOS routines. When the VMM initiated page-ins or page-outs to a permanent swap file, FastDisk transferred data entirely within 32-bit protected mode, eliminating costly context switches between protected mode and real mode.
  2. 32-Bit File Access (VFAT): Introduced in Windows for Workgroups 3.11, this feature replaced the underlying real-mode MS-DOS file system with a 32-bit protected-mode implementation. This allowed even temporary swap files (WIN386.SWP) to benefit from faster protected-mode disk caching and transfer routines without dropping into real-mode DOS.