Windows 95 Virtual Memory and the WIN386.SWP File
Windows 95 represented a major leap forward in PC memory management
by implementing a dynamic 32-bit virtual memory system centered around
the WIN386.SWP file. Unlike its predecessors, which
required users to choose between rigid permanent or inefficient
temporary swap files, Windows 95 automatically adjusted the size of
WIN386.SWP based on application demand and available disk
space. This article explains how the operating system utilized this file
to page memory, optimize physical RAM, and maintain system stability on
resource-constrained hardware.
The Role of Virtual Memory in Windows 95
Windows 95 relied on the protected mode architecture of Intel 80386 and later processors to implement flat-model 32-bit addressing. Each 32-bit application was allocated a private 4 GB virtual address space, with the lower 2 GB dedicated to the process and the upper 2 GB reserved for shared system services and core components.
Because physical RAM in the mid-1990s was typically limited to 8 MB to 32 MB, the operating system depended heavily on virtual memory to bridge the gap between application demand and physical capacity.
The Mechanism of WIN386.SWP
The Virtual Machine Manager (VMM32.VXD) handled memory management using standard 4 KB memory pages. When the system ran low on physical RAM, it employed demand paging:
- Identifying Inactive Pages: The memory manager tracked memory usage and identified pages containing code or data that had not been accessed recently.
- Writing to Disk: If the page had been modified
("dirty"), the VMM wrote its 4 KB contents into
WIN386.SWP. Clean pages containing unmodified application code could simply be discarded, as they could be reloaded directly from the original executable file if needed. - Paging In: When an application attempted to access
an address located on disk, the CPU generated a page fault. The VMM
intercepted this fault, located the required page inside
WIN386.SWP, loaded it back into an available physical RAM frame, and resumed execution seamlessly.
Dynamic Allocation vs. Legacy Swap Files
Under Windows 3.1, users had to choose between a slow temporary swap
file or a contiguous, permanent swap file that permanently reserved a
fixed block of hard drive space. Windows 95 modernized this approach by
making WIN386.SWP fully dynamic:
- Automatic Expansion: When applications required
more memory than physical RAM could accommodate, the VMM expanded
WIN386.SWPin chunks, provided the underlying hard drive had free space. - Automatic Shrinkage: When programs closed and
memory pressure dropped, the operating system shrank
WIN386.SWP, returning unneeded disk space to the file system. - Location: The file was typically created as a
hidden, system file in the Windows directory or at the root of the boot
drive (e.g.,
C:\WIN386.SWP).
Fragmentation and Performance Tweaks
While dynamic resizing eliminated the need for manual configuration
for average users, it came with a performance cost: disk fragmentation.
Repeatedly expanding and shrinking WIN386.SWP on an active
FAT16 or FAT32 partition caused the swap file itself to become
fragmented, leading to severe disk thrashing when paging occurred.
To counter this, power users and system administrators often configured the swap file manually through the System Control Panel:
- Fixed Size: Setting the minimum and maximum sizes to the exact same value prevented the file from resizing, keeping it contiguous if set immediately after a disk defragmentation.
- Drive Relocation: Moving
WIN386.SWPto a separate physical drive or partition prevented contention between system paging and standard file read/write operations.
Through WIN386.SWP, Windows 95 balanced user convenience
with preemptive multitasking requirements, allowing complex 32-bit
software suites to run on hardware that possessed only a fraction of the
required physical memory.