On Wed, Dec 30, 2009 at 11:25 AM, Pierre-Yves Kerembellec <py.kerembel...@gmail.com> wrote: >> Now, as a word of advice: multithreading is (imho) extremely complicated, >> expect that you will have to learn a lot. [...] >> Keep also in mind that threads are not very scalable (they are meant to >> improve performance on a single cpu only and decrease performance on >> multiple cores in general), and since the number of cores will increase >> more and more in the near future, they might not be such a good choie. > > "Decrease performance on mutiple core in general" ? But what about a > single-threaded > single process program ? It wouldn't benefit from multiple cores (since the > kernel > wouldn't schedule this program on mote than one core at a time anyway), right > ?
A well-designed multi-threaded program can scale better over multiple cores than a single-process, single-threaded program, yes :) What he's referring to is that in the general case, a multi-process program will scale better over increasingly large core counts than a multi-threaded program, because the shared address space of the threads tends to lead to memory/cache performance issues even on non-NUMA machines, and obviously on NUMA machines the problems get even worse when the threads that share active chunks of memory might want to be scheduled on several different NUMA nodes. However, a *carefully designed* multi-threaded program can avoid these sorts of memory issues in many cases, but then that gets back into another component of why "multithreading is (imho) extremely complicated". -- Brandon _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev