Pre-emptive vs. Cooperative Multitasking

Billy Tanksley tanksley@mailhost2.csusm.edu
Tue, 18 Jul 1995 22:56:19 -0700 (PDT)


On Mon, 17 Jul 1995, Jecel Mattos de Assumpcao Jr. wrote:

> The discussion reproduced here only examines one aspect of the difference
> between the two types of multitasking. Don't forget that:

>   - 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.

Note that all that good stuff is destroyed by the fact that you must poll 
for tasks at all other times.  It would seem far more efficient to use a 
preemptive scheme with special keywords to allow guaranteed primary 
execution.

Essentially, the only advantage I can see for cooperative MT is during 
short critical loops, and why not just explicitly give those loops 
control?

>   - Pre-emptive Multitasking: Doesn't lose control to buggy
>     applications.

Also don't need to worry about timing.  Also, your program is independant 
of all the other programs running-- the ideal of functional programming.

On the negative side, state-saving is uncertain.

> -- Jecel

-Billy