Subj : Re: Lock Free -- where to start To : comp.programming.threads From : chris noonan Date : Fri Oct 14 2005 10:39 am David Schwartz wrote: > The optimum number of concurrent threads is one per processor if the > threads are CPU bound. I still don't understand what you think the > connection between IOCP and lock efficiency is. Maybe it's obvious to you, > but I don't see it. I'm genuinely curious. I agree in principle about the optimum number of threads. However when there is no synchronisation between the threads the performance loss suffered by having a large number of threads is so tiny as not to be measurable. My IOCP point was more philosophical than technical: a "one thread good, many threads bad" mantra has evolved through experience of operating systems that take so many locks that multi- threaded performance dives (that is my guess, I can't be sure). IOCP is a means of reducing the number of threads running, at the cost of software complexity. > In any event, if you don't have 1000 CPUs, it's pretty dumb for you to > have 1000 ready-to-run threads. If you do have 1000 CPUs, it's really just > the time it takes to do *one* context switch. It's dumb to run 1000 threads if you expect performance deterioration. If I were programming a thousand-client-server under Microsoft Windows, I'd use IOCP. What I am interested in is the reason for the performance deterioration. Chris .