Subj : Re: Lock Free -- where to start To : comp.programming.threads From : chris noonan Date : Fri Oct 14 2005 10:52 am Dave Butenhof wrote: > > One context switch takes place every timeslice (say 20 > > milliseconds) whether there are two threads or 1000. > > This frequency (50 Hz) of context switching reduces > > throughput slightly but not greatly. How do I know? > > Because the operating system timeslice is determined > > as a tradeoff between throughput and latency. > It's a tradeoff based on arbitrary data that doesn't apply to ANY real > application except occasionally and purely by accident. In many > application workloads the impact can indeed be "great". On average, no > application is average... I don't understand. If thread-switching is driven by I/0, then it doesn't matter what the timeslice is. If the application is CPU-heavy, then the OS designers say something like "a 20 ms timeslice loses us 3% of the CPU and that's acceptable". It doesn't matter what real applications do. Admittedly Microsoft (e.g.) may not have bothered updating their timeslices as processors have become faster. Admittedly applications may differ in their latency requirements. I don't think it's a matter worth fussing over. Chris .