admin管理员组

文章数量:1315347

On LWN, the URCU library is said to require all reading threads to (un-)register themselves, as well as indicate their quiescent state, in order to make use of QSBR.

However, each thread must periodically invoke rcu_quiescent_state(), just as in the kernel, where schedule() must be invoked periodically. Each thread that is to execute RCU read-side critical sections must also invoke rcu_register_thread() after thread creation and rcu_unregister_thread() before thread exit.

or later

QSBR provides the highest performance, but requires that all reader threads periodically indicate quiescent states via either rcu_quiescent_state() for a momentary quiescent state or using rcu_thread_offline()/rcu_thread_online() pairs for extended quiescent states

On the same page, the table reads, that it's generally not OK to use QSBR for RCU in library code.

Given, that a library knows, that it has to (un-)register it's thread, when it has to indicate it's quiescent state and when it's a reader thread, I fail to understand how this is relevant.

After all, any application would never access library data directly but only through the library interface.

And even if it did, it should be possible to provide wrappers to the user, that have to be called from application code, or am I missing something?

p. 807 in Chapter E.9. of Perfbook, claims that "each and every thread" needs to indicate their quiescent state. This would make more sense. But if a thread is neither a reader nor a writer thread, isn't it automatically in quiescent state?

本文标签: multithreadingWhy is QSBR unsuitable for use in librariesStack Overflow