Although mutexes allow us to perform concurrency correctly they are not the fastest way to achieve concurrency. There are more factors that affect performance.
This includes things such as cache. If we use a reader Writer Lock, it is going to be cache unfriendly on multiple core systems so it might not perform better than a mutex.
There is an optimisation objective we can frame as having fast reads and slower writes (we trade off write speed for maximum read speed). This is valuable in real world applications where we have such scenarios such as in .
Left-right data structure achieves this. This allows readers to be completely independently: which means the reads and lock-free and wait-free. Instead, the writes make contention where all the reading threads are updated with the new information by the writing thread.
This allows speed of reads to increase with the number of cores instead of decrease.
This is why when dealing with concurrency, you need to choose algorithms that best match the data transfer patterns of your use case.
For example, left-right is not a drop-in replacement
False sharing: If cache lines contain multiple counters, it is bad.