diff --git a/appendix/appendix.tex b/appendix/appendix.tex index 3de3b021..0e63a533 100644 --- a/appendix/appendix.tex +++ b/appendix/appendix.tex @@ -887,7 +887,7 @@ \section{Implementing CVs with Mutexes Alone} So how does this work? Instead of allocating space which could lead to deadlock. We keep the data structures or the linked list nodes on each thread's stack. -The linked list in the wait function is created \textbf{While the thread has the mutex lock} this is important because we may have a race condition on the insert and removal. +The linked list in the wait function is created \textbf{while the thread has the mutex lock.} This is important because we may have a race condition on the insert and removal. A more robust implementation would have a mutex per condition variable. What is the note about (dynamic)? @@ -897,7 +897,7 @@ \section{Implementing CVs with Mutexes Alone} After the last thread leaves, meaning when head is NULL, then the binding is lost. The signal and broadcast functions merely tell either one thread or all threads respectively that they should be woken up. -\textbf{It doesn't modify the linked lists because there is no mutex to prevent corruption if two threads call signal or broadcast} +\textbf{It doesn't modify the linked lists because there is no mutex to prevent corruption if two threads call signal or broadcast.} Now an advanced point. Do you see how a broadcast could cause a spurious wakeup in this case? Consider this series of events. diff --git a/introc/language_facilities.tex b/introc/language_facilities.tex index 25ddfb0f..60fde8e7 100644 --- a/introc/language_facilities.tex +++ b/introc/language_facilities.tex @@ -579,7 +579,7 @@ \subsection{Operators} short sig = 1; // 0000000000000001 uns << 2; // 1111111000000100 sig << 2; // 0000000000000100 -uns >> 2; // 1111111111100000 +uns >> 2; // 0011111111100000 sig >> 2; // 0000000000000000 \end{lstlisting} Note that shifting by the word size (e.g. by 64 in a 64-bit architecture) results in undefined behavior.