lkwt in DragonFly

David Cuthbert dacut at kanga.org
Tue Feb 10 20:40:54 PST 2004


Dan Melomedman wrote:
For instance many people
blindly assume that creating a bazillion threads is okay because they
are somehow magically faster than processes, but don't even bother profiling.
Profiling across thread and process boundaries is a pain.

The wonderful call graphs you get when profiling a single threaded
application are hopelessly obfuscated or even downright wrong in MT
environments.  CPU time measurements never tell the whole story.
Wall time measurements are subject to other phenomena.
My solution to this is to avoid MT in my apps as much as possible.
Event loops are far preferable.  MT is best used in small parts of the
code (say, needing to select() across a bunch of file descriptors while
waiting for a child process in a wait() call).
(On NT this case wasn't an issue -- WaitForMultipleObjects() could take
fds and process handles; of course, they had to go and screw up WinSocks
and no system calls could grok their handles...)





More information about the Kernel mailing list