and a matter of a few hours of testing to tweak the balance of "cede"s inside the synch routine and in the normal loop to match up nicely
That is the problem with cooperative threading/event systems: balancing the needs of the various concurrent processes so that the high speed events are processed in a timely fashion without breaking up the long running parts in to such iddy biddy chunks that nothing ever gets done. And the more concurrency you need the harder that balancing act becomes.
But the very worst part is that just as soon as you get everything balanced and cooperating nicely, the requirements change--a new one is added or an existing one is no longer required and you have to start the whole process over from scratch. I remember one such system in a production environment that processed the same three dummy datafiles over and over hundreds of time every day--in each of 300 stores--for years, simply because it was easier, than trying to remove that processing and re-balance the system.
The users could not believe how much more responsive the systems were when we replaced the old, cooperative DOS-based system with one that multi-tasked under OS/2. A part of the change was because of newer faster hardware, but most of it came simply because 40% of the cpu's time was no longer being used to 'busy work', processing files that were no longer required, but too difficult and risky to consider removing. We calculated that over the preceding 4 years, those same three files had been pointlesly reprocessed just short of a billion times!
The reason preemptive multi-tasking predominates, is because you write simple, linear flows for each task and let the scheduler take care of mixing them up. When an old task is no longer needed, or a new task it required, you just add or remove it. You don't have to go messing with everything else in the system to restore the balance.
Anyway, I'm glad you found a solution that works for you. As an aside, if the code isn't proprietary, I'd love to get a copy and see if it's possible to do what you need with threading?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|