Multitasking

Windows is a multitasking system: more than one application can run at a time. In the standard DOS environment, there are no particular provisions for multitasking. Programs written for the DOS environment typically assume that they have exclusive control of all resources in the computer, including the input and output devices, memory, the system display, and even the CPU itself. In Windows, however, applications must share these valuable resources with all other applications that are currently running. For this reason, Windows carefully controls these resources, and requires Windows applications to use a specific program interface that guarantees Windows' control of those resources.

For example, in the standard DOS environment, a program has access to all of memory that has not been taken up by the system, by the program, or by terminate-and-stay-resident (TSR) programs. This means that programs are free to use all of available memory for whatever they like and may access memory by whatever method they like.

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 blocks. This means you cannot assume that objects to which you have assigned a memory location remain where you put them. If there are several applications running, Windows may move and discard memory blocks often.

Another example of a shared resource is the system display. In the standard DOS environment, the system typically grants your application exclusive use of the system display. This means you can use the display in any manner you like, from changing the color of text and background, to changing the video mode from text to graphics. In Windows, your application must share the system display with other applications, so it must not take control of the display.