On Sun, Jun 01, 1997 at 07:45:23PM -0500, John Griessen wrote: > When you say cooperative multitasking, are you > meaning MT where the code moves between any and > all possible combinations of output states, waiting > and testing at each one for conditions that say to > go to a new output state and wait again? > > Or, are you meaning MT where an OS handles checking > conditions and some output actions and sequences are > coded as a thread with no consideration of the others > except knowing that the OS is being used simultaneously > by them too? I'm not sure I understand exactly what you are describing in the first paragraph, but the second describes what is usually called "preemptive" multitasking. Cooperative multitasking is multitasking where a context switch occurs only when the current task or thread decides it is prepared to relinquish the CPU. This is usually done by calling an OS function, e.g. Yield(), which will either return immediately if no other task is ready to run, or perform a context switch if there is another task ready. Preemptive multitasking allows context switches to be triggered by interrupts and other asynchronous events. Win32 is preemptive, Win16 is cooperative. That's why Win3.1 gets stupid whenever a program does something busy, like saving a file. Cooperative multitasking is often well suited to embedded applications, because you have complete control over every task, and can ensure that each task is well-behaved. Preemptive multitasking is more complex to implement, and more prone to unexpected behaviour, but essential for a hosted OS that must be able to run programs that may not be well behaved. -- Clyde Smith-Stubbs | HI-TECH Software, | Voice: +61 7 3354 2411 clyde@htsoft.com | P.O. Box 103, Alderley, | Fax: +61 7 3354 2422 http://www.htsoft.com | QLD, 4051, AUSTRALIA. | --------------------------------------------------------------------------- Download a FREE beta version of our new ANSI C compiler for the PIC microcontroller! Point your WWW browser at http://www.htsoft.com/