PENN PRINTOUT
The University of Pennsylvania's Online Computing Magazine

PENN PRINTOUT November 1991 - Volume 8:3

[Printout | Contents | Search ]


Windows: Memory management

By Kristin Nelson

Windows 3.0x can run in three different modes (real, standard, and 386 enhanced) depending on the type of chip and the amount of RAM memory installed in your IBM or compatible. (See Penn Printout, October, 1991, "Windows 3.0: Should you Use it?" for more information on Windows modes.) How Windows uses memory, and which type of memory (conventional, expanded, or extended) it and DOS or Windows applications use, depend on which of the three modes you are running.


Real mode

In real mode, Windows only uses conventional memory - the 640 Kbyte base area of RAM that has been the traditional limit for DOS applications. Because this relatively small amount of memory is insufficient for running both Windows and a DOS or Windows application, Windows will swap portions of its code to disk when not needed, and free up conventional memory for the application. Real mode tends to be slow because Windows must repeatedly access the hard disk and because of the constraints imposed by the 640 Kbyte limit.


Standard mode

Standard mode brings with it the benefit of access to extended memory for Windows applications, but not for DOS applications. Extended memory is memory above 1 Mbyte, which is seen by programs as a single block of contiguous memory locations. Windows applications can use all installed memory-up to 16 Mbytes on a 286 machine, and 4 Gbytes on a 386 machine-and they run more quickly than in enhanced mode, even with large files.

While Windows applications make use of all available memory, most DOS applications still insist on running in the conventional memory area (up to 640 Kbytes); as in real mode, swapping code to disk still causes a bottleneck in loading applications. A few DOS applications, such as Lotus 1-2-3, can use expanded memory. This is no different than when they are running under DOS alone. Expanded memory, although slow, takes advantage of available space in the area between 640 Kbytes and 1 Mbyte, and requires a separately installed expansion card when used with an 8088, 8086, or 286 processor.


386 enhanced mode

386 enhanced mode provides all the memory management benefits that Windows has to offer. Windows applications access extended memory as in standard mode, and more than one application can run at a time (multitasking). Individual DOS applications still run within a 640 Kbyte limit; however, Windows manipulates extended memory to create separate 640 Kbyte "virtual DOS machines," enabling more than one DOS application to run at a time. Expanded memory required by certain DOS applications can be emulated as needed, using installed extended memory- there's no need to install an additional memory board if there is sufficient memory on the main processor board. In addition, 386 enhanced mode automatically enables virtual memory (using the hard drive as if it were additional RAM) if you run out of installed RAM. Because of all the behind-the-scenes memory manipulation, 386 enhanced mode operates more slowly than standard mode.


Conclusion

For DOS applications, Windows' memory management capabilities come into play only in 386 enhanced mode, to provide multitasking and automatic access to expanded memory for those DOS applications that can use it. In other modes, where these features are not available, the primary benefit of running DOS applications under Windows is that often- cryptic DOS commands are replaced by Windows' graphical menus; this benefit must, however, be weighed against a loss in speed compared with running the application under DOS alone. For Windows applications, Windows offers automatic access to all installed memory in standard and enhanced mode. Additional memory-related capabilities are available in enhanced mode, but at the cost of reduced speed.


KRISTIN NELSON is a Consultant for the Computing Resource Center.