HOME

TheInfoList



OR:

Cooperative multitasking, also known as non-preemptive multitasking, is a
computer multitasking In computing, multitasking is the concurrent computing, concurrent execution of multiple tasks (also known as Process (computing), processes) over a certain period of time. New tasks can interrupt already started ones before they finish, instea ...
technique in which the
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
never initiates a
context switch In computing, a context switch is the process of storing the state of a process or thread, so that it can be restored and resume execution at a later point, and then restoring a different, previously saved, state. This allows multiple processes ...
from a running
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management * Business process, activities that produce a specific s ...
to another process. Instead, in order to run multiple applications concurrently, processes voluntarily yield control periodically or when idle or logically blocked. This type of multitasking is called ''cooperative'' because all programs must cooperate for the scheduling scheme to work. In this scheme, the process scheduler of an operating system is known as a cooperative scheduler whose role is limited to starting the processes and letting them return control back to it voluntarily. This is related to the
asynchronous programming Asynchrony, in computer programming, refers to the occurrence of events independent of the main program flow and ways to deal with such events. These may be "outside" events such as the arrival of signals, or actions instigated by a program that t ...
approach.


Usage

Although it is rarely used as the primary scheduling mechanism in modern operating systems, it is widely used in memory-constrained
embedded systems An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is em ...
and also, in specific applications such as
CICS IBM CICS (Customer Information Control System) is a family of mixed-language application servers that provide online business transaction management, transaction management and connectivity for applications on IBM mainframe systems under z/OS ...
or the
JES2 The Job Entry Subsystem (JES) is a component of IBM's MVS ( MVS/370 through z/OS) mainframe operating systems that is responsible for managing batch workloads. In modern times, there are two distinct implementations of the Job Entry System call ...
subsystem. Cooperative multitasking was the primary scheduling scheme for 16-bit applications employed by
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
before Windows 95 and Windows NT, and by the classic Mac OS. Windows 9x used non-
preemptive multitasking In computing, preemption is the act performed by an external scheduler — without assistance or cooperation from the task — of temporarily interrupting an executing task, with the intention of resuming it at a later time. This preemptive sc ...
for 16-bit legacy applications, and the
PowerPC PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
Versions of Mac OS X prior to
Leopard The leopard (''Panthera pardus'') is one of the five extant cat species in the genus ''Panthera''. It has a pale yellowish to dark golden fur with dark spots grouped in rosettes. Its body is slender and muscular reaching a length of with a ...
used it for
classic A classic is an outstanding example of a particular style; something of Masterpiece, lasting worth or with a timeless quality; of the first or Literary merit, highest quality, class, or rank – something that Exemplification, exemplifies its ...
applications.
NetWare NetWare is a discontinued computer network operating system developed by Novell, Inc. It initially used cooperative multitasking to run various services on a personal computer, using the IPX network protocol. The final update release was ver ...
, which is a network-oriented operating system, used cooperative multitasking up to NetWare 6.5. Cooperative multitasking is still used on
RISC OS RISC OS () is an operating system designed to run on ARM architecture, ARM computers. Originally designed in 1987 by Acorn Computers of England, it was made for use in its new line of ARM-based Acorn Archimedes, Archimedes personal computers an ...
systems. Cooperative multitasking is similar to
async/await In computer programming, the async/await pattern is a syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function. It is semantically r ...
in languages, such as
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
or Python, that feature a single-threaded event-loop in their runtime. This contrasts with cooperative multitasking in that await cannot be invoked from a non-async function, but only an async function, which is a kind of
coroutine Coroutines are computer program components that allow execution to be suspended and resumed, generalizing subroutines for cooperative multitasking. Coroutines are well-suited for implementing familiar program components such as cooperative task ...
. Cooperative multitasking allows much simpler implementation of applications because their execution is never unexpectedly interrupted by the process scheduler; for example, various functions inside the application do not need to be reentrant.


Problems

As a cooperatively multitasked system relies on each process regularly giving up time to other processes on the system, one poorly designed program can consume all of the CPU time for itself, either by performing extensive calculations or by
busy wait In computer science and software engineering, busy-waiting, busy-looping or spinning is a technique in which a process repeatedly checks to see if a condition is true, such as whether keyboard input or a lock is available. Spinning can also be use ...
ing; both would cause the whole system to hang. In a
server Server may refer to: Computing *Server (computing), a computer program or a device that provides requested information for other programs or devices, called clients. Role * Waiting staff, those who work at a restaurant or a bar attending custome ...
environment, this is a hazard that is often considered to make the entire environment unacceptably fragile, though, as noted above, cooperative multitasking has been used frequently in server environments including NetWare and CICS. In contrast, preemptive multitasking interrupts applications and gives control to other processes outside the application's control. The potential for system hang can be alleviated by using a
watchdog timer A watchdog timer (WDT, or simply a ''watchdog''), sometimes called a ''computer operating properly timer'' (''COP timer''), is an electronic or software timer that is used to detect and recover from computer malfunctions. Watchdog timers are wide ...
, often implemented in hardware; this typically invokes a
hardware reset In a computer or data transmission system, a reset clears any pending errors or events and brings a system to normal condition or an initial state, usually in a controlled manner. It is usually done in response to an error condition when it is ...
.


References

{{DEFAULTSORT:Nonpreemptive Multitasking Concurrent computing de:Multitasking#Kooperatives Multitasking