On Tue, May 26, 2009 at 3:15 PM, Isaac Marino Bavaresco < isaacbavaresco@yahoo.com.br> wrote: > Preemption may happen just at specific points (when the macro is > called), but only if the tick has elapsed, unlike a "Yield" that forces > a switch every time it is called. > Some posts ago I was suggesting something like that and there could be a small advantage in rare cases where you need to do a loop for example and it is safe to 'redo' the loop at any point. For example you mark the beginning of the loop as a safe reentry point and then you do not need to yield the scheduler at every cycle to make the decision if a task switch is needed -- less overhead for sure. However, the point is that using an RTOS you are not controlling the resources directly therefore not polling or wasting the CPU with delay loops etc. For those you can use the OS provided functions -- if nothing else then queues or semaphores/mutexes. In that way a cooperative scheduler is just as fine especially when you have interrupt/event driven routines as well (so your normal task can still be interrupted by any time by an ISR executing an event handler and then returning to your task). As Olin suggested this can be well done by normal programming style using interrupts and well organised program structure. It may can be another discussion though whenever in this case you are writing your own scheduler for yourself without even realizing that it was a scheduler. Tamas -- http://www.mcuhobby.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist