I know there are many reader-preferred rwlock, and there are even more aggressive design such as RCU, which are usually considered reader-preferred.
But what if the writers are not much less than the readers? I know a writer-only rwlock will fall back to an exclusive lock, but consider following patterns
- writer-most, but there are some readers, perhaps 80% W vs 20% R?
- writers and readers are even, 50% W vs 50% R
- readers-most, but writers can not be ignored and they have requirement on latency, 20% W vs 80% R
I have two questions
- Do such cases really exist, especially the first 2 cases? I don't know any user-level applications that fit into those types. User-level examples are preferred.
- If there is indeed an application that fits into type 1/2/3, is there any existing way to improve the lock performance?