[PATCH v3] Make fprintf() function to multithread-safe

Roland McGrath roland@hack.frob.com
Tue Jul 10 09:18:00 GMT 2012


There is no need to target individuals in your email.
Just post to the list.

Please file a bugzilla report for this issue.

I am not at all sanguine about taking any global locks in vfprintf,
even a reader lock.  It is a code path that is extremely common and
often performance-critical.  Conversely, register_printf_specifier
et al are called very rarely and their performance never matters much.

I think it's worth investigating an alternative approach where
changes work by allocating a new table and replacing the old one
with atomic operations.  There is complexity there about tracking
when it's safe to free the old table, so it's not a trivial change.

Perhaps the reader locks are in fact just as efficient (for the
reader) as anything that could be done with the atomic-supersede
style.  But I think it merits some real investigation and concrete
performance analysis.


Thanks,
Roland



More information about the Libc-alpha mailing list