Mon Jan 23 18:33:07 HKT 2017
Stealing thread - http://badamczewski.blogspot.com.au/2012/05/work-stealing.html
Intel Guide for Developing Multithreaded Applications - http://software.intel.com[..]or-developing-multithreaded-applications
Difference ways to stop a thread - http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/
Interesting, I am not sure if I agree, but chrome ( which use fork ) are really cool in performance:
There’s another problem with Unix programming in Ruby that I’ll just touch on briefly: Java people and Windows people. They’re going to tell you that fork(2) is bad because they don’t have it on their platform, or it sucks on their platform, or whatever, but it’s cool, you know, because they have native threads, and threads are like, way better anyways.
Don’t ever let anyone tell you that fork(2) is bad. Thirty years from now, there will still be a fork(2) and a pipe(2) and a exec(2) and smart people will still be using them to solve hard problems reliably and predictably, just like they were thirty years ago.
MRI Ruby people need to accept, like Python (you have seen multiprocessing, yes?), that Unix processes are one of two techniques for achieving reliable concurrency and parallelism in server applications. Threads are out. You can use processes, or async/events, or both processes and async/events, but definitely not threads. Threads are out.
1x1 win M*N - http://binkley.blogspot.com/2012/01/1-1-beats-n-m.html
Best number of threads:
N = number of CPUs
U = target CPU utilization (0 <= U <= 1)
W/C = ration of wait time to cpu time (measured through profiling)
threads = N * U * (1 + W/C) - http://www.ibm.com/developerworks/library/j-jtp0730.html http://stackoverflow.com[..]ratio-of-java-threads-to-cpus-on-solaris
Another post about tuning thread pool - http://www.javaadvent.com[..]ortance-of-tuning-your-thread-pools.html
Threads Basics - http://www.hpl.hp.com/techreports/2009/HPL-2009-259html.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/threadsintro.html
The Dos and Don'ts of Multithreading - http://www.infoq.com/presentations/multithreading
(google search) (amazon search)