Re-" Often, RW locks aren't a win because maintaining just the read locks (without any writers) introduces contention at the hardware level, and parallelism does not increase all that much as a result. " - Yes, RWlock has a small price compared to no lock (it still stays in user space and does not require any syscall if no writer is in), but is a significant improvement compared to straight forward mutex, which even in case of all readers will put a bunch of contexts to sleep on the futex_wait().
Igor. -----Original Message----- From: Salz, Rich Sent: Wednesday, June 11, 2014 8:26 AM To: openssl-dev@openssl.org Cc: Levin, Igor Subject: RE: Locking inefficiency > What kinds of operations are protected by read locks? Looking at almost any of the global data structures, such as error tables, OID tables, and so on. >Often, RW locks aren't a win because maintaining just the read locks (without >any writers) introduces contention at the hardware level, and parallelism does >not increase all that much as a result. Paul McKenney's dissertation on RCU >has some examples. We've monitored one of our applications, an SSL-terminating HTTP proxy server, under load. Of all the mutexes (futex, actually) in the system, the "error" lock is the most highly contended one. I'll see about posting some statistics. /r$ -- Principal Security Engineer Akamai Technologies, Cambridge, MA IM: rs...@jabber.me<mailto:rs...@jabber.me>; Twitter: RichSalz