March 27th, 2017

How real-mode Windows loaded code from the disk, and how you could use that to minimize disk swapping

Real-mode Windows was originally designed to run on a PC with 192KB of RAM and two 360KB floppy drives. We saw some time ago that code was loaded dynamically off the disk on demand. The same principle also applies to read-only data, like resources.

Now, you might not have enough disk space on two floppies to hold the core operating system files, the program you’re trying to run, and your data files. No problem.

When Windows needed to load code from the disk, it searched the path for the module, opened it, read the necessary bytes from disk into memory, and then closed the file handle. This means that when the disk is not in active use, any floppy can be removed and swapped for a different floppy.

You typically organized your floppy disks like this:

  1. Windows system files.
  2. The program you’re trying to run.
  3. Your data files.

You started with Windows in drive A: and your data files in drive B:. Then you swapped your program disk into drive A: and ran your program. If Windows needed to access any system files, you swapped the Windows system floppy back in.

If you’ve been paying close attention, you may have noticed a sneaky optimization opportunity: If you have some extra room on floppy 2, you can put duplicate copies of popular system files on floppy 2, in a directory structure that matches floppy 1. Whenever Windows needs to access a file in order to load code from it, it searches the path. If you put a copy on both floppy 1 and floppy 2, then no matter which one you have in drive A:, Windows will find it and you won’t be asked to swap disks. (If you were really crazy, you could add B: to your path and put some program files on your data disk.)

Or you could go and buy a hard drive. A 10 megabyte hard drive held the equivalent of 28 floppies and set you back around $700 (over $1500 in today’s dollars).

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.