Cooperative multitasking unlike preemptive multitasking has many benefits. For one, variables can be easily shared among different tasks. This simplifies the necessary code needed immensely as you don't need to take any necessary precautions while sharing variables in a typical interrupt driven preemptive environment. Cooperative multitasking also allows many tasks to be run at once (as they only appear to... time slices are actually given to each function running just like in any modern multitasking OS). The microcontrollers also take advantage of the natural delays that occur in most code execution to provide cpu cycles to other tasks.
Playing with this multitasking environment I was able to update information on an LCD via an array of switches in real-time, without taking any time away from any other running timers or processes. It essentially allows me to run several tasks at the same time while providing data input without the necessity of any type of interrupt. This is extremely powerful.

No comments:
Post a Comment