Subj : Re: MT server side app book advice To : comp.programming.threads From : David Schwartz Date : Tue May 24 2005 03:03 pm "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:d6vf4c$u7k$05$1@news.t-online.com... > I have not read his book, but I've participated in some discussions with > the author in this newsgroup, and I'm afraid his views on thread > programming > are not uptodate, some may even say old- or odd-style. > He is practically saying that multithreading on a single CPU would not > make any sense. He's saying one would need one CPU per thread. When > I asked him how he would serve 1000 simultanous clients, ie. whether he > would use a server with 1000 CPU's to do the job, he unfortunately refused > to answer. So, I believe you would much be disappointed of the book. > I would suggest a newer and a more modern book on threads programming. > I think the following free book and examples from Sun will give you > more than the above one: http://docs.sun.com/app/docs/doc/805-5080 (HTML > version) > http://docs-pdf.sun.com/805-5080/805-5080.pdf (PDF version) Holy cow! You advise against the book you have not read because the author wouldn't answer your question? As a third party observer, it is my opinion that Dr. Buthenhof has given you *much* more of a reply than you deserve, given your unwillingness to even spend the time to understand anyone else's view. By the way, to answer your questions: 1) Multi-threading on a single CPU makes plenty of sense. Other threads can continue running if one thread gets blocked on a page fault or some other kind of I/O. Multi-threading may also make the design cleaner in some cases. 2) You do want one thread per CPU, at least, if your goal is to be able to make use of all the CPUs. Obviously, with five CPUs and four threads, you can't use all the CPUs (unless you manage to get some kernel code that is multi-threaded to do it for you). But you want get all the CPUs running application code. 3) You don't need more CPUs or more threads to get more work done. You just need more CPUs to get more work done per unit time, and you may need more threads to keep more CPUs busy or pend more I/Os. But an increased number of clients does not translate into an increased need for threads, unless more I/Os need to be pended or more CPUs kept busy, which is not normally the case. An increased number of clients does not translate into an increased need for CPUs unless more clients means more computation is needed and the CPUs are the limiting factor. DS .