On Wed, Feb 09, 2005 at 07:55:19PM +0100, Didier Dambrin wrote: > let's say someone made an app that was doing lengthy stuff, and always > ping-pong-ing between 2 processes. If the OS really directly switch from > one OS to another, wouldn't that leave an app a way to litterally freeze > the OS? It's a lot more complicated than just passing control. Scheduling heuristics have been fine-tuned over years to get a good balance of reliability vs speed. If you fully exhaust your time slice, then you will be rescheduled and other tasks will have a chance to run. If you don't exhaust your timeslice, you have a much better chance of being run before something that DID fully exhaust it's timeslice. If your priority is high enough, then yes, you can lock up the system (well, you get all the user CPU time). With Linux, at least, (assuming no RT priorities) all processes get their priority recalculated periodically based on how long they run, how often they block, etc. What you end up with is that your 2 ping-ponging tasks get most of the CPU time, but more importantly, they get the least scheduling latency. Really, task scheduling is as much an art as a science. I point you at kernel/sched.c in the Linux kernel for some *fun* reading :) ---------------------------------------------------------------------- Generalized Music Plugin Interface (GMPI) public discussion list Participation in this list is contingent upon your abiding by the following rules: Please stay on topic. You are responsible for your own words. Please respect your fellow subscribers. Please do not redistribute anyone else's words without their permission. Archive: //www.freelists.org/archives/gmpi Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe