Threading does take advantage of MP inasmuch as other processes can
run on the other CPU. The threads of a single process schedule faster
on the same CPU schedule faster than they would if they were run on
seperate cpus, and run "in parallel" in the same way that seperate
processes do on UP. A lot of OSs got this wrong when threading first
became the vogue, and now tout this as a feature, when its a
performance loss. Linux has this 100% right.
Don't believe what you read in books about this either. If cache
affinity (and the process memory shared between threads) isn't
important to your application, then your app should probably not be
threaded, but rather take the form of multiple seperate processes (a
la qmail). These can easily and profitably be scheduled on seperate
CPUs (Although gang-scheduling means that they should probably still
have strong processor affinity also).
Migrating threads on to seperate CPUs is just one of those things that
a lot of people seem to think should be a good idea, but if you do the
benchmarks, you see it isn't.
If you need more info about this, Larry McVoy is the man. I believe
he has written several papers about exactly these issues from his days
at Sun. They're on his website (start at http://www.bitmover.com - I
think that has a link to his personal papers).
Sean
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/