Question:

What is the difference between cooperative multitasking and preemptive multitasking?

by  |  earlier

0 LIKES UnLike

 Tags:

   Report

2 ANSWERS


  1. Cooperative Multitasking:-
    When computer usage evolved from batch mode to interactive mode, multiprogramming was no longer a suitable approach. Each user wanted to see his program running as if it was the only program in the computer. The use of time sharing made this possible, with the qualification that the computer would not seem as fast to any one user as it really would be if it were running only that user's program.

    Early multitasking systems consisted of suites of related applications that voluntarily ceded time to each other. This approach, which was eventually supported by many computers operating systems, is today known as cooperative multitasking. Although it is rarely used in larger systems, Microsoft Windows prior to Windows 95 and Windows NT, and Mac OS prior to Mac OS X both used cooperative multitasking to enable the running of multiple applications simultaneously. Windows 9x also used cooperative multitasking, but only for 16-bit legacy applications, much the same way as pre-Leopard PowerPC versions of Mac OS X used it for Classic applications. The network operation system NetWare used cooperative multitasking up to NetWare 6.5. Cooperative multitasking is still used today on RISC OS systems.

    Because a cooperatively multitasked system relies on each process to regularly give time to other processes on the system, one poorly designed program can cause the whole system to hang. In a server environment, this is a hazard that makes the network brittle and fragile. All software must be evaluated and cleared for use in a test environment before being installed on the main server, or the entire network either slows down or comes to a halt when a program on the server misbehaves.

    Preemptive Multitasking:-
    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.

    Operating systems were developed to take advantage of these hardware capabilities and run multiple processes preemptively. For example, preemptive multitasking was implemented in the earliest version of Unix [1] in 1969, and is standard in Unix and Unix-like operating systems, including Linux, Solaris and BSD with its derivatives.

    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 primitive systems, the software would often "poll", or "busywait" while waiting for requested input (such as disk, keyboard or network input). During this time, the system was not performing useful work. With the advent of interrupts and preemptive multitasking, 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.

    The earliest preemptive multitasking OS available to home users was Sinclair QDOS on the Sinclair QL released in 1984. The Commodore Amiga 1000 released in 1985 (demonstrated by Debbie Harry and Andy Warhol at its unveiling) made use of a preemptive multi-tasking kernel that performed the circus act without a net (MPU) while managing a coprocessor that could process 80 instructions per scan line — no other computer on the market could touch it at the time, which was the sole reason the NewTek Video Toaster was developed to make use of its features. Preemptive multitasking was later adopted on the Apple Macintosh by Mac OS 9.x [2] as an additional API, i.e. the application could be programmed to use the preemptive or co-operative model, and all legacy applications were multitasked cooperatively within a single process. Mac OS X, being a Unix-like system, uses preemptive multitasking for all native applications, although Classic applications may be multitasked cooperatively because they in fact run under Mac OS 9 that itself is running as an OS X process.

    A similar model is used in Windows 9x and Windows NT family, where native 32-bit applications are multitasked preemptively, and legacy 16-bit Windows 3.x are multitasked cooperatively within a single process, although in the NT family it is possible to force 16-bit application to run as a separate preemptively multitasked process.[3] 64-bit editions of Windows, both for the x86-64 and Itanium architectures no longer provide support for legacy 16-bit applications, and thus provide preemptive multitasking for all supported applications.


  2. Cooperative Multitasking: Mostly avoids the need to explicitly
    >     control resource sharing. Allows you to violate "invariants"
    >     to boost performance as long as things are restored to normal
    >     before the next task switching point.
    Pre-emptive Multitasking: Doesn't lose control to buggy
    >     applications.

    by: jakubu yaibwan

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.