How Windows 98 Managed Win386.swp Virtual Memory

This article explores how Microsoft Windows 98 handled virtual memory through its dynamic swap file, Win386.swp. It details the underlying 32-bit Virtual Machine Manager (VMM) architecture, the shift from static to dynamic paging, the operational challenges such as disk fragmentation and performance stutter, and the manual configuration methods users relied on to optimize system stability.

The Role of Win386.swp

Windows 98 relied on demand paging to run applications that required more physical Random Access Memory (RAM) than was physically installed in the PC. The operating system used a hidden swap file named Win386.swp—typically located in the root directory C:\ or inside C:\WINDOWS—as secondary storage to hold inactive 4 KB memory pages.

Memory management was directed by the 32-bit Virtual Machine Manager (VMM32.VXD). When the system's physical RAM reached capacity, the VMM utilized a Least Recently Used (LRU) paging algorithm to identify memory pages that were not actively in use, transfer them from RAM onto the hard drive inside Win386.swp, and free up physical memory for active processes. When an application required that swapped-out data again, the VMM triggered a page fault and read the data back into RAM.

Dynamic Paging by Default

Unlike Windows 3.1, which strongly encouraged users to create a permanent, contiguous swap file to achieve usable performance, Windows 98 defaulted to a completely dynamic swap file model.

Under the default configuration:

  • The system automatically expanded Win386.swp on demand as running applications allocated more memory.
  • When applications closed and freed memory, the VMM truncated the file to return disk space to the file system.
  • The operating system monitored available free space on the host drive and capped the swap file dynamically based on remaining disk capacity.

Performance Issues and Disk Fragmentation

While dynamic paging saved disk space on smaller drives, it introduced significant performance bottlenecks on the hardware of the late 1990s:

  1. Severe Disk Fragmentation: Because Win386.swp constantly grew and shrank alongside regular file creation and deletion, the file quickly became fragmented across non-contiguous sectors on FAT16 and FAT32 partitions. This caused the mechanical drive heads to seek constantly during page swaps.
  2. System Hesitation: Allocating and deallocating disk clusters on the fly required file system operations that frequently caused noticeable interface stutter, audio hitching, or temporary system freezes during heavy multitasking.

Manual Configuration and Optimization

To resolve the downsides of dynamic allocation, advanced users and system administrators commonly managed Win386.swp manually through the Windows GUI or direct configuration file edits.

Setting a Static Size in System Properties

Users could bypass dynamic resizing via Control Panel > System > Performance > Virtual Memory:

  • Selecting "Let me specify my own virtual memory settings" allowed users to define a fixed Minimum and Maximum size in megabytes.
  • Setting both the minimum and maximum values to the exact same size (typically 2 to 2.5 times the amount of physical RAM) forced Windows 98 to treat Win386.swp as a fixed, permanent file.
  • Running the Disk Defragmenter prior to creating a fixed swap file ensured that the space allocated to Win386.swp was contiguous, minimizing drive head movement.

System.ini Directives

These adjustments modified the [386Enh] section of the SYSTEM.INI file. The primary directives included:

  • PagingFile=C:\Win386.swp: Defined the file location.
  • PagingDrive=C:: Assigned the drive partition designated for swap space.
  • MinPagingFileSize=[KB]: Set the lower threshold for the swap file size in kilobytes.
  • MaxPagingFileSize=[KB]: Set the upper limit for the swap file size in kilobytes.
  • ConservativeSwapfileUsage=1: A popular tweak in Windows 98 Second Edition that instructed the VMM to exhaust available physical RAM before writing any data to Win386.swp, substantially speeding up everyday operations on machines with 128 MB of RAM or more.