Changeset 24a3d2b for doc/theses/thierry_delisle_PhD/thesis/text
- Timestamp:
- Jul 25, 2022, 11:36:34 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 970fa54
- Parents:
- 1988572
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/thesis/text/practice.tex
r1988572 r24a3d2b 193 193 Interestingly, general notification, \ie waking any idle processor versus a specific one, does not strictly require modifying the list. 194 194 Here, contention can be reduced notably by having notifiers avoid the lock entirely by adding a pointer to the event @fd@ of the first idle \proc, as in Figure~\ref{fig:idle2}. 195 To avoid contention among notifiers, notifiers atomically exchange it to @NULL@ so only one notifier contends on the system call. 196 The first notifier will succeed the atomic exchange and obtain the @fd@ of an idle \proc. 197 The notifier will the normally write to the @fd@, which will wake a \proc. 198 The woken \proc can then update the atomic pointer while it is updating the head of the list. 199 Notifiers that obtained a @NULL@ in the exchange simply move on, knowing that another notifier is already waking a \proc. 195 To avoid contention among notifiers, notifiers atomically exchange the pointer with @NULL@. 196 The first notifier succeeds on the exchange and obtains the @fd@ of an idle \proc; 197 hence, only one notifier contends on the system call. 198 This notifier writes to the @fd@ to wake a \proc. 199 The woken \proc then updates the atomic pointer, while it is updating the head of the list, as it removes itself from the list. 200 Notifiers that obtained a @NULL@ in the exchange simply move on knowing that another notifier is already waking a \proc. 200 201 This behaviour is equivalent to having multiple notifier write to the @fd@ since reads consume all previous writes. 201 202 … … 208 209 209 210 The next optimization is to avoid the latency of the event @fd@, which can be done by adding what is effectively a binary benaphore\cit{benaphore} in front of the event @fd@. 210 A simple three state flag is added beside the event @fd@ to avoid unnecessary system calls, as shownin Figure~\ref{fig:idle:state}.211 The benaphore over the event @fd@ logically provides a three state flag to avoid unnecessary system calls, where the states are expressed explicit in Figure~\ref{fig:idle:state}. 211 212 A \proc begins its idle sleep by adding itself to the idle list before searching for an \at. 212 213 In the process of adding itself to the idle list, it sets the state flag to @SEARCH@.
Note: See TracChangeset
for help on using the changeset viewer.