Steve Clamage wrote: > > > On 09/09/08 02:35, Darren J Moffat wrote: >> Steve Clamage wrote: >>>>> I agree with Stefan that we need to do some measurements to see >>>>> whether the performance difference is important. >>>> But it's also important to consider whether the common uses are in >>>> MT or >>>> single-threaded programs. Why even bother measuring the cost for >>>> single-threaded programs if they are not the target, or if no >>>> consequential single-threaded programs exist that might use this >>>> library? >>> >>> SPEC. >> >> What does that mean ? > > > Standard Performance Evaluation Corporation > http://www.spec.org/ > Sun, especially the software division, lives and dies by SPEC > performance measurements. Artificially reducing performance has > consequences for the entire company.
That said, Darren's other comments seem particularly apropos -- if libraries are permitted to create threads at any time, then it becomes impossible for developers to predict whether their program (for non-trivial programs at least) will be MT or not, and therefore all libraries must be thread-safe. The libc should have an optimization that on single CPU systems the mutexes involved are noops. That doesn't help single threaded applications on SMP systems, but it does help single CPU systems at least. :-) Besides which, I thought uncontended mutexes were supposed to be *cheap*. -- Garrett