Windows 3.11 DOS Background Execution via PIF Files
In Microsoft Windows 3.11, running MS-DOS applications simultaneously alongside graphical Windows software required a specialized virtualization and configuration mechanism. While native Windows 3.11 applications relied on cooperative multitasking, DOS applications were managed through 386 Enhanced Mode using Program Information Files (PIF) to dictate resource allocation. By configuring specific execution flags within these PIF files, users allowed legacy DOS processes to run continuously in the background using preemptive time-slicing managed by the Virtual Machine Manager.
The Role of 386 Enhanced Mode
Windows 3.11 processed background execution for DOS programs only when operating in 386 Enhanced Mode. In this mode, Windows leveraged the Intel 80386 processor’s Virtual 8086 (V86) mode. Instead of sharing a single memory space, each DOS program ran inside its own isolated Virtual Machine (VM).
While 16-bit Windows programs had to yield control cooperatively, the
core operating environment (WIN386.EXE) acted as a
preemptive scheduler for these separate Virtual Machines. To know
whether a particular DOS VM was permitted to consume CPU cycles when it
was not the active window, the system read the application's associated
.PIF file.
PIF Files and the PIF Editor
A Program Information File (.PIF) was a 545-byte binary
file containing metadata about how Windows should configure the
environment for a DOS executable (.EXE, .COM,
or .BAT). Users configured these settings using the PIF
Editor (PIFEDIT.EXE) included with Windows.
When a user launched a DOS program, Windows searched for a
corresponding PIF file with the same base name. If none was found, it
applied system-wide defaults from _DEFAULT.PIF.
The Background Execution Flag
Within the PIF Editor’s "Execution" section, two primary checkboxes controlled execution states:
- Background: When checked, this setting set a specific bit in the PIF header instructing Windows not to suspend the DOS Virtual Machine when focus switched to another window or application. If left unchecked, the scheduler immediately halted the VM's execution threads as soon as it lost focus.
- Exclusive: If checked, this setting caused Windows to suspend all other background applications—both Windows tasks and other background DOS tasks—whenever this specific DOS application held the foreground focus.
Enabling "Background" was essential for tasks such as downloading files via a modem in a terminal program, compiling code, or running batch processing scripts while continuing to use word processors or spreadsheets in the foreground.
Priority Scheduling and Time-Slicing
Beyond simply enabling background execution, the PIF file governed how much CPU time a background DOS program received relative to other active tasks. The PIF configuration provided two numeric values ranging from 0 to 10000:
- Foreground Priority: The scheduling weight given to the program when its window was active.
- Background Priority: The scheduling weight given to the program when another window was active.
The Windows 386 Enhanced Mode scheduler calculated the percentage of CPU time assigned to any active task using a ratio:
\[\text{Task CPU Share} = \frac{\text{Task Priority Value}}{\sum (\text{Active Foreground Priority} + \text{All Running Background Priorities})}\]
If a user assigned a background priority of 50 to a background DOS task and the active foreground application had a foreground priority of 100, the background DOS task received roughly one-third (50 out of 150 total priority units) of the CPU’s available time slices.
Virtual Device Drivers (VxDs) and Interrupts
When running in the background, a DOS program had no direct access to physical display adapters or input devices. Windows 3.11 utilized Virtual Device Drivers (VxDs) to manage hardware abstraction:
- Virtual Display Driver (VDD): Handled video writes silently into a virtualized frame buffer rather than the physical display adapter, preventing background DOS apps from corrupting the Windows desktop.
- Virtual Timer Device (VTD): Provided continuous virtual timer ticks (IRQ 0) to the background VM, ensuring software loops and internal clocks inside the DOS program continued advancing accurately.
- Virtual Communications Driver (VCD): Maintained continuous serial port polling and data transfer without buffer overruns while the terminal program ran hidden or minimized.