Pre-emptive multitasking

From Wikipedia, the free encyclopedia

Pre-emptive multitasking is a form of multitasking. To understand the concept, compare to cooperative multiprocessing, in which only the active task (also known as process) may initiate a context switch because the task has:

  1. completed processing.
  2. become blocked on a shared resource.
  3. yielded the processor to another, similarly cooperative, task.

In pre-emptive multitasking, the operating system kernel can also initiate a context switch to satisfy the scheduling policy's priority constraint, thus pre-empting the active task.

Pre-emptive multitasking is sometimes mistakenly used when the intended meaning is more specific, referring instead to the class of scheduling policies known as time-shared scheduling, or time-sharing.

Preemptive multitasking allows the computer system to more reliably guarantee each process a regular "slice" of operating time. It also allows the system to rapidly deal with important external events like incoming data, which might require the immediate attention of one or another process.

At any specific time, processes can be grouped into two categories: those that are waiting for input or output (called "I/O bound"), and those that are fully utilizing the CPU ("CPU bound"). In early systems, processes would often "poll", or "busywait" while waiting for requested input (such as disk, keyboard or network input). During this time, the process was not performing useful work, but still maintained complete control of the CPU. With the advent of interrupts and preemptive multitasking, these I/O bound processes could be "blocked", or put on hold, pending the arrival of the necessary data, allowing other processes to utilize the CPU. As the arrival of the requested data would generate an interrupt, blocked processes could be guaranteed a timely return to execution.

Although multitasking techniques were originally developed to allow multiple users to share a single machine, it soon became apparent that multitasking was useful regardless of the number of users. Many operating systems, from mainframes down to single-user personal computers, have recognized the usefulness of multitasking support for a variety of reasons. Multitasking makes it possible for a single user to run multiple applications at the same time, or to run "background" processes while retaining control of the computer.

In simple terms: Pre-emptive multitasking involves the use of a scheduler which hands out CPU time to various processes so that they can be performed simultaneously. Therefore all processes will get some amount of CPU time at any given time.

[edit] List of systems that use pre-emptive multitasking

Novell NetWare below version 5.0, versions of Microsoft Windows up to Windows for Workgroups, and versions of Mac OS prior to X to are all examples of co-operative multitasking operating systems.)

Windows 95 and 98 only pre-emptively multitask if the running software is capable of dealing with pre-emptive multitasking. Much of it is not. Even tasks which are part of the operating system (eg updating graphics and window displays) are often adversely affected by programs which "busy wait".

[edit] See also

In other languages