SMPdesign: Apply \clnref{} scheme to Listing 6.5
PATCH 1/2 SMPdesign: Apply \clnref{} scheme to Listing 6.5
Commit a7a722ddae4c ("SMPdesign: Work in the spacetime partitioning viewpoint") used raw line counts for referencing lines in Listing 6.5.
Embedding line labels in the code snippet and using \clnref{} can reduce the risk of line-count mismatches in the future.
--- SMPdesign/SMPdesign.tex | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
SMPdesign/SMPdesign.tex +10 -6
@@ -208,6 +208,7 @@ has now become three statements due to the need to release the lock before returning. \begin{listing} +\begin{fcvlabel}[ln:SMPdesign:Code-Locking Hash Table Search] \begin{VerbatimL}[commandchars=\\\[\]] spinlock_t hash_lock;
@@ -227,32 +228,35 @@ int hash_search(struct hash_table *h, long key) struct node *cur; int retval; - spin_lock(&hash_lock); + spin_lock(&hash_lock); \lnlbl[acq] cur = h->buckets[key % h->nbuckets]; while (cur != NULL) { if (cur->key >= key) { retval = (cur->key == key); - spin_unlock(&hash_lock); + spin_unlock(&hash_lock); \lnlbl[rel1] return retval; } cur = cur->next; } - spin_unlock(&hash_lock); + spin_unlock(&hash_lock); \lnlbl[rel2] return 0; } \end{VerbatimL} +\end{fcvlabel} \caption{Code-Locking Hash Table Search} \label{lst:SMPdesign:Code-Locking Hash Table Search} \end{listing} -Note that the \co{hash_lock} acquisition and release statements on lines~19, -24, and~29 are mediating ownership of the hash table among the CPUs -wishing to concurrently access that hash table. +\begin{fcvref}[ln:SMPdesign:Code-Locking Hash Table Search] +Note that the \co{hash_lock} acquisition and release statements on +\clnref{acq,rel1,rel2} are mediating ownership of the hash table among +the CPUs wishing to concurrently access that hash table. Another way of looking at this is that \co{hash_lock} is partitioning time, thus giving each requesting CPU its own partition of time during which it owns this hash table. In addition, in a well-designed algorithm, there should be ample partitions of time during which no CPU owns this hash table. +\end{fcvref} \QuickQuiz{ ``Partitioning time''?
base-commit: bccd13b1e32770a985dfceb971ddf814785dcd41
Signature · 1 line
2.25.1
PATCH 2/2 SMPdesign: Fix typos
---
I'm not 100% sure these are the right fixes. Sending this one in the hope of getting Paul's attention.
Thanks, Akira
--
SMPdesign/SMPdesign.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
SMPdesign/SMPdesign.tex +2 -2
@@ -260,7 +260,7 @@ of time during which no CPU owns this hash table. \QuickQuiz{ ``Partitioning time''? - Isn't that is an odd turn of phrase? + Isn't that an odd turn of phrase? }\QuickQuizAnswer{ Perhaps so.
@@ -593,7 +593,7 @@ Another important instance of data ownership occurs when the data is read-only, in which case, all threads can ``own'' it via replication. -Where data locking partitioned both the address space space (with one +Where data locking partitions both the address space (with one hash buckets per partition) and time (using per-bucket locks), data ownership partitions only the address space. The reason that data ownership need not partition time is because a
Signature · 1 line
2.25.1
Re: [PATCH -perfbook 2/2] SMPdesign: Fix typos
Quoted 4 lines · Akira Yokosawa
Signed-off-by Akira Yokosawa <[email protected]>---
I'm not 100% sure these are the right fixes. Sending this one in the hope of getting Paul's attention.
You got them all right, thank you!
I queued and pushed both patches.
Thanx, Paul
Quoted 32 lines
Thanks, Akira
--SMPdesign/SMPdesign.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)SMPdesign/SMPdesign.tex +2
-2@@ -260,7 +260,7 @@ of time during which no CPU owns this hash table. \QuickQuiz{ ``Partitioning time''? - Isn't that is an odd turn of phrase? + Isn't that an odd turn of phrase? }\QuickQuizAnswer{ Perhaps so.@@ -593,7 +593,7 @@ Another important instance of data ownership occurs when the data is read-only, in which case, all threads can ``own'' it via replication. -Where data locking partitioned both the address space space (with one +Where data locking partitions both the address space (with one hash buckets per partition) and time (using per-bucket locks), data ownership partitions only the address space. The reason that data ownership need not partition time is because aSignature · 1 line
2.25.1