How to make a multiple-read/single-write lock from more basic synchronization primitives?

后端 未结 8 759
[愿得一人]
[愿得一人] 2020-11-29 17:45

We have found that we have several spots in our code where concurrent reads of data protected by a mutex are rather common, while writes are rare. Our measurements seem to s

8条回答
  •  一生所求
    2020-11-29 17:56

    Concurrent reads of data protected by a mutex are rather common, while writes are rare

    That sounds like an ideal scenario for User-space RCU:

    URCU is similar to its Linux-kernel counterpart, providing a replacement for reader-writer locking, among other uses. This similarity continues with readers not synchronizing directly with RCU updaters, thus making RCU read-side code paths exceedingly fast, while furthermore permitting RCU readers to make useful forward progress even when running concurrently with RCU updaters—and vice versa.

提交回复
热议问题