Skip to content

Commit 12f8325

Browse files
committed
It's condition variables, not conditional variables...
1 parent 135134f commit 12f8325

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

threads.tex

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@
728728
\item will describe:
729729
\begin{itemize}
730730
\item mutexes
731-
\item conditional variables
731+
\item condition variables
732732
\item read-write locks
733733
\end{itemize}
734734
\end{itemize}
@@ -739,7 +739,7 @@
739739
\begin{itemize}
740740
\item Process synchronization is described on pages
741741
\pageref{SYNCHRONIZATION} to \pageref{SYNCHRONIZATIONEND}.
742-
\item By using mutexes and conditional variables it is possible to construct any
742+
\item By using mutexes and condition variables it is possible to construct any
743743
other synchronization model.
744744
\item The exact behavior of synchronization primitives is largely determined by
745745
the scheduler. It decides which of the threads waiting for releasing a lock
@@ -921,24 +921,24 @@
921921
%%%%%
922922

923923
\begin{slide}
924-
\sltitle{Conditional variables (1)}
924+
\sltitle{Condition variables (1)}
925925
\begin{itemize}
926926
\item mutexes provide synchronization for shared data
927-
\item conditional variables pass information about the shared data --
927+
\item condition variables pass information about the shared data --
928928
for example that the value has changed
929929
\item \dots{}and allows to put threads to sleep and wake them up
930930
\item therefore \emsl{each condition variable is always associated
931931
with exactly one mutex}
932-
\item one mutex can be associated with multiple conditional variables
933-
\item using mutexes and conditional variables it is possible to construct
932+
\item one mutex can be associated with multiple condition variables
933+
\item using mutexes and condition variables it is possible to construct
934934
other synchronization primitives -- semaphores, barriers, \dots
935935
\end{itemize}
936936
\end{slide}
937937

938938
\label{CONDITION_VARIABLES}
939939

940940
\begin{itemize}
941-
\item In other words -- conditional variables are handy in a situation when a
941+
\item In other words -- condition variables are handy in a situation when a
942942
thread needs to test the state of \emsl{shared} data (e.g. number of elements in
943943
a queue) and voluntarily put itself to sleep if the state is not as desired.
944944
The sleeping thread may be woken up by another thread after the latter
@@ -949,7 +949,7 @@
949949
will be saved anywhere, it is as if it never happened.
950950
\item A condition variable, which is an opaque type for the programmer, is not
951951
associated with a concrete condition like ``\emph{\texttt{n} is greater than
952-
7}''. A conditional variable may in fact be compared to a flag of a certain
952+
7}''. A condition variable may in fact be compared to a flag of a certain
953953
color; if it is lifted up, it means that the threads waiting for the flag to be
954954
raised are informed (= woken up) and may use this information to its own
955955
judgment. Some threads may wait for \texttt{n} to be bigger than 7, some other
@@ -962,7 +962,7 @@
962962
that they are woken up whenever the variable changed. If the variable is not
963963
equal to 7 the thread must voluntarily put itself to sleep again. As it is
964964
explained further, the \emsl{test is necessary to perform after an every
965-
wake-up} even if a dedicated conditional variable is used for every possible
965+
wake-up} even if a dedicated condition variable is used for every possible
966966
state -- it may happen that the system can wake up a sleeping thread (because
967967
of various implementation reasons) without any other thread causing this; it is
968968
called a \emsl{spurious wakeup}.
@@ -976,29 +976,29 @@
976976
]]])
977977

978978
\begin{slide}
979-
\sltitle{Conditional variables (2)}
979+
\sltitle{Condition variables (2)}
980980
\prgchars
981981
ifdef([[[NOSPELLCHECK]]], [[[
982982
\funml{int \funnm{pthread\_cond\_init}(\=pthread\_cond\_t *\emph{cond},
983983
\\\>const pthread\_condattr\_t *\emph{attr});}
984984
]]])
985985
\begin{itemize}
986-
\item initializes conditional variable \texttt{cond} with attributes \texttt{attr}
986+
\item initializes condition variable \texttt{cond} with attributes \texttt{attr}
987987
(they are set with the \texttt{pthread\_condattr\_...()} functions),
988988
\texttt{NULL} = default.
989989
\end{itemize}
990990
ifdef([[[NOSPELLCHECK]]], [[[
991991
\texttt{int \funnm{pthread\_cond\_destroy}(pthread\_cond\_t *\emph{cond});}
992992
]]])
993993
\begin{itemize}
994-
\item destroys conditional variable.
994+
\item destroys condition variable.
995995
\end{itemize}
996996
ifdef([[[NOSPELLCHECK]]], [[[
997997
\funml{int \funnm{pthread\_cond\_wait}(\=pthread\_cond\_t *\emph{cond},
998998
\\\>pthread\_mutex\_t *\emph{mutex});}
999999
]]])
10001000
\begin{itemize}
1001-
\item waits on conditional variable until another thread calls
1001+
\item waits on condition variable until another thread calls
10021002
ifdef([[[NOSPELLCHECK]]], [[[
10031003
\funnm{pthread\_cond\_signal()} or \funnm{pthread\_cond\_broadcast()}.
10041004
]]])
@@ -1018,12 +1018,12 @@
10181018
if they are blocked. It is important to perform this under the protection of
10191019
the mutex, to be sure what is the state of the data when calling
10201020
\texttt{pthread\_cond\_wait}.
1021-
\item The conditional variables API works thanks to the fact that when entering
1021+
\item The condition variables API works thanks to the fact that when entering
10221022
critical section the mutex is locked by the thread and the
10231023
\emsl{\texttt{pthread\_cond\_wait} function will unlock the mutex before putting
10241024
the thread to sleep}. Before exiting from the function the mutex is locked
10251025
again. It may therefore happen that the thread is woken up while waiting on a
1026-
conditional variable and then put to sleep again when hitting a mutex already
1026+
condition variable and then put to sleep again when hitting a mutex already
10271027
locked by another thread. There is nothing complicated about this, it is merely
10281028
a mutual exclusion of threads in a critical section.
10291029
\end{itemize}
@@ -1036,20 +1036,20 @@
10361036
]]])
10371037

10381038
\begin{slide}
1039-
\sltitle{Conditional variables (3)}
1039+
\sltitle{Condition variables (3)}
10401040
\prgchars
10411041
ifdef([[[NOSPELLCHECK]]], [[[
10421042
\texttt{int \funnm{pthread\_cond\_signal}(pthread\_cond\_t *\emph{cond});}
10431043
]]])
10441044
\begin{itemize}
1045-
\item wakes up one thread waiting on conditional variable
1045+
\item wakes up one thread waiting on condition variable
10461046
\texttt{cond}.
10471047
\end{itemize}
10481048
ifdef([[[NOSPELLCHECK]]], [[[
10491049
\texttt{int \funnm{pthread\_cond\_broadcast}(pthread\_cond\_t *\emph{cond});}
10501050
]]])
10511051
\begin{itemize}
1052-
\item wakes all threads waiting on conditional variable
1052+
\item wakes all threads waiting on condition variable
10531053
\texttt{cond}.
10541054
\end{itemize}
10551055
ifdef([[[NOSPELLCHECK]]], [[[
@@ -1064,7 +1064,7 @@
10641064
\end{slide}
10651065

10661066
\begin{itemize}
1067-
\item One conditional variable can be used to announce multiple situations at
1067+
\item One condition variable can be used to announce multiple situations at
10681068
once -- e.g. when inserting or removing an item to/from a queue. Because of
10691069
this, it is necessary to test the condition the thread is waiting for. Another
10701070
consequence of this is that it is necessary to use a broadcast in such a
@@ -1095,7 +1095,7 @@
10951095

10961096
\begin{slide}
10971097
\label{CONDVAR_USE}
1098-
\sltitle{Using conditional variables}
1098+
\sltitle{Using condition variables}
10991099
\begin{alltt}
11001100
pthread\_cond\_t cond; pthread\_mutex\_t mutex;
11011101
...

0 commit comments

Comments
 (0)