1.1.4 Multitasking Capabilities

Windows is a multitasking operating system—that is, it can run more than one application at a time. The standard MS-DOS operating system has no particular multitasking capabilities. An MS-DOS application typically operates as though it has exclusive control of all resources in the computer, including the input and output devices, memory, the screen, and even the CPU itself. A Windows application, however, must share these resources with all other applications that are currently running. For this reason, Windows carefully controls these resources and requires Windows applications to use a program interface that guarantees that Windows maintains control of those resources.

For example, an MS-DOS application has access to all memory that has not been taken up by the system, by the application itself, or by terminate-and-stay-resident programs (often called TSRs). This means that applications are free to use all available memory for any purpose and may access it by any method.

In Windows, memory is a shared resource. Since more than one application can be running at the same time, each application must cooperatively share memory to avoid exhausting the resource. Applications may allocate what they need from system memory. Windows provides two sources of memory: global memory, for large allocations; and local memory, for small allocations. To make the most efficient use of memory, Windows often moves or even discards memory objects. This means an application cannot “assume” that objects to which it has assigned a memory location remain where it put them. If several applications are running, Windows may move and discard memory objects often.

Another example of a shared resource is the screen. The system typically grants an MS-DOS application exclusive use of the screen, allowing the application to perform many operations, from changing the color of text and background to changing the video mode from text to graphics. A Windows application, however, must share the screen with other applications and must not take control of the screen.