Windows 3.11 Swap File Fragmentation Management
Microsoft Windows 3.11 addressed virtual memory swap file fragmentation primarily through prevention rather than active defragmentation, relying on the strict architectural distinction between permanent and temporary swap files. By requiring a permanent swap file to occupy completely contiguous disk clusters on a local drive, Windows 3.11 bypassed the performance penalties of drive fragmentation entirely. When contiguous space was unavailable, the operating system relied on external DOS-based defragmentation utilities to reorganize disk clusters before allocating virtual memory space.
The Permanent Swap File Architecture
To achieve optimal performance in 386 Enhanced Mode, Windows 3.11
utilized a permanent swap file named 386SPART.PAR. Unlike
standard DOS files, a permanent swap file was strictly required to be
completely unfragmented upon creation.
During setup via the Control Panel's Virtual Memory dialog, Windows scanned the local File Allocation Table (FAT16) file system to identify the largest contiguous block of unallocated disk clusters. The operating system capped the maximum allowable swap file size to the size of this single contiguous block. If a disk had several gigabytes of total free space, but the largest contiguous segment was only 20 megabytes, Windows 3.11 would not allow the user to create a permanent swap file larger than 20 megabytes.
Once created, the physical locations of these clusters were
permanently reserved and recorded. Windows marked these clusters as bad
or hidden in the FAT to prevent DOS from writing over them, accompanied
by a hidden pointer file named SPART.PAR in the Windows
directory.
Bypassing the File System with 32-Bit Disk Access
The strict contiguous requirement of the permanent swap file was
directly tied to 32-Bit Disk Access (FastDisk). When enabled via the
WDCTRL driver, Windows 3.11 bypassed standard MS-DOS (INT
21h) and BIOS (INT 13h) routines to communicate directly with Western
Digital-compatible hard drive controllers.
Because this low-level driver read and wrote directly to physical disk sectors rather than traversing the FAT directory tree, it could not navigate non-contiguous cluster chains. Guaranteeing that the swap file was entirely contiguous eliminated the need to track file fragmentation tables during virtual memory paging, significantly speeding up page-in and page-out operations.
Resolution via External Defragmentation
Windows 3.11 did not possess a native, built-in defragmentation engine capable of consolidating disk space from within the GUI. If drive fragmentation prevented a user from creating an adequately sized permanent swap file, the issue had to be resolved outside of the Windows environment:
- The user had to exit Windows completely to the MS-DOS command prompt.
- The user ran a stand-alone DOS defragmentation utility, such as
DEFRAG.EXE(included with MS-DOS 6.0 and later) or third-party tools like Norton Speed Disk. - The defragmenter was configured to move files to the beginning of the drive, consolidating all free space into one large, contiguous block at the end of the partition.
- Upon rebooting and relaunching Windows 3.11, the Virtual Memory control panel would recognize the unified free space, allowing the user to create the desired permanent swap file size.
Temporary Swap Files and Non-Contiguous Handling
If a user chose not to create a permanent swap file, Windows 3.11
defaulted to a temporary swap file named WIN386.SWP.
A temporary swap file was created dynamically when Windows started and deleted upon exit. Because it operated through standard MS-DOS file system calls, it was allowed to be fragmented across non-contiguous clusters anywhere on the drive. However, this flexibility came at the expense of performance. A fragmented temporary swap file incurred constant drive-head movement during paging and was fundamentally incompatible with 32-Bit Disk Access, causing Windows 3.11 to fall back to slower 16-bit BIOS disk routines. Consequently, Windows documentation and setup wizards consistently guided users toward contiguous permanent swap files to mitigate fragmentation issues on local hard drives.