Subj : Re: Futexes are wrong! (Are they?) To : comp.programming.threads From : David Schwartz Date : Wed Jun 08 2005 04:36 pm "Jomu" wrote in message news:1118269884.989800.121510@g14g2000cwa.googlegroups.com... >I would not hire clerk for every customer, but efficiency grows as > number of clerks is nearer to number of customers currently shopping > :). No, it's not. The clerks just fight over the cash registers and get in the way of the customers. There exists some ideal number of clerks at which the most customers per second can be served, and above this number of clerks, things just get worse. > Thats one thing. Another thing, there is surely known percentage of > oglers in any shop - and there is no such luxury in our designs - > oglers are lost performance. I'm not sure how this fits the analogy. If by oglers you mean customers that don't require servicing, well that's right, and that's one of the problems with thread-per-connection -- many of your threads are doing nothing. > When you create pools, you loose when, for example, two clients > needeing attention atm are served by same thread. I am sure this > situation is not so rare. Ideal would be if them would distribute their > moments of needed attention, but something tells me Murphy lives there > too. No, you win in this case, because there's no context switch. Imagine if eighteen clients need servicing at once and you only have four CPUs. You do best if four threads start running and each one handles a client and then as soon as it finishes that client starts on another one. Having eighteen threads fight for the scheduler doesn't help at all. DS .