summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2023-07-11 11:28:44 -0700
committerPaul E. McKenney <paulmck@kernel.org>2023-07-11 11:28:44 -0700
commitb48ccb045d17f6d551ff210c74118f1769f66c63 (patch)
treeafad42aa1074cc482ba6680fef076ee4a20504f1
parent5eb3e8e52c57aad41c0a79154ab96e917a54aba6 (diff)
downloadperfbook-b48ccb045d17f6d551ff210c74118f1769f66c63.tar.gz
memorder: Add QQ on rwlock intuitions
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r--memorder/memorder.tex16
1 files changed, 16 insertions, 0 deletions
diff --git a/memorder/memorder.tex b/memorder/memorder.tex
index a414f369..3a7391cf 100644
--- a/memorder/memorder.tex
+++ b/memorder/memorder.tex
@@ -5704,6 +5704,22 @@ of that same lock:
Here, ``some later value'' is shorthand for ``the value stored by some
intervening access''.
+\QuickQuiz{
+ But what about reader-writer locking?
+}\QuickQuizAnswer{
+ Reader-writer locking works the same as does exclusive locking,
+ with the proviso that ordering is guaranteed only between a
+ pair of conflicting critical sections.
+ This means that a read-side critical section will be ordered
+ before a later write-side critical section and vice versa.
+ But this also means that there is no guarantee of ordering
+ between a pair of read-side critical sections unless there is
+ an intervening write-side critical section.
+
+ As of mid-2023, LKMM does not yet model reader-writer locking,
+ but this is on the to-do list.
+}\QuickQuizEnd
+
Locking is strongly intuitive, which is one reason why it has survived
so many attempts to eliminate it.
This is also one reason why you should use it where it applies.