Changeset 970fa54 for doc/theses/thierry_delisle_PhD/thesis/text
- Timestamp:
- Jul 25, 2022, 11:47:36 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 8fe35be
- Parents:
- 6a6544d (diff), 24a3d2b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/thesis/text/practice.tex
r6a6544d r970fa54 199 199 Interestingly, general notification, \ie waking any idle processor versus a specific one, does not strictly require modifying the list. 200 200 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}. 201 To avoid contention among notifiers, notifiers atomically exchange it to @NULL@ so only one notifier contends on the system call. 202 The first notifier will succeed the atomic exchange and obtain the @fd@ of an idle \proc. 203 The notifier will the normally write to the @fd@, which will wake a \proc. 204 The woken \proc can then update the atomic pointer while it is updating the head of the list. 205 Notifiers that obtained a @NULL@ in the exchange simply move on, knowing that another notifier is already waking a \proc. 201 To avoid contention among notifiers, notifiers atomically exchange the pointer with @NULL@. 202 The first notifier succeeds on the exchange and obtains the @fd@ of an idle \proc; 203 hence, only one notifier contends on the system call. 204 This notifier writes to the @fd@ to wake a \proc. 205 The woken \proc then updates the atomic pointer, while it is updating the head of the list, as it removes itself from the list. 206 Notifiers that obtained a @NULL@ in the exchange simply move on knowing that another notifier is already waking a \proc. 206 207 This behaviour is equivalent to having multiple notifier write to the @fd@ since reads consume all previous writes. 207 208 Note that with and without this atomic pointer, bursts of notification can lead to an unspecified number of \procs being woken up, depending on how the arrival notification compares witht the latency of \procs waking up. … … 217 218 218 219 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@. 219 A simple three state flag is added beside the event @fd@ to avoid unnecessary system calls, as shownin Figure~\ref{fig:idle:state}.220 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}. 220 221 A \proc begins its idle sleep by adding itself to the idle list before searching for an \at. 221 222 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.