An operating system cannot implement multitasking without doing something about memory management. As new programs are started up and old ones terminate, memory can become fragmented. The system must be able to consolidate free memory space. This requires the system to move blocks of code and data in memory.
Even Windows 1, running on an 8088 microprocessor, was able to perform this type of memory management. Under real mode, this can only be regarded as an astonishing feat of software engineering. Programs running under Windows can overcommit memory; a program can contain more code than can fit into memory at any one time. Windows can discard code from memory and later reload the code from the program's .EXE file. A user can run several copies (called ”instances“) of a program; all these instances share the same code in memory. Programs running in Windows can share routines located in other .EXE files called ”dynamic link libraries.“ Windows includes a mechanism to link the program with the routines in the dynamic link libraries at run time. Windows itself is a set of dynamic link libraries.
Thus, even in Windows 1, the 640-KB memory limit of the PC's architecture was effectively stretched without requiring any additional memory. But Microsoft didn't stop there: Windows 2 gave the Windows applications access to expanded memory (EMS), and Windows 3 runs in protected mode to give Windows applications access to up to 16 megabytes (MB) of extended memory.