Changeset 24a3d2b


Ignore:
Timestamp:
Jul 25, 2022, 11:36:34 AM (19 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
970fa54
Parents:
1988572
Message:

small updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/thesis/text/practice.tex

    r1988572 r24a3d2b  
    193193Interestingly, general notification, \ie waking any idle processor versus a specific one, does not strictly require modifying the list.
    194194Here, 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.
     195To avoid contention among notifiers, notifiers atomically exchange the pointer with @NULL@.
     196The first notifier succeeds on the exchange and obtains the @fd@ of an idle \proc;
     197hence, only one notifier contends on the system call.
     198This notifier writes to the @fd@ to wake a \proc.
     199The woken \proc then updates the atomic pointer, while it is updating the head of the list, as it removes itself from the list.
     200Notifiers that obtained a @NULL@ in the exchange simply move on knowing that another notifier is already waking a \proc.
    200201This behaviour is equivalent to having multiple notifier write to the @fd@ since reads consume all previous writes.
    201202
     
    208209
    209210The 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 shown in Figure~\ref{fig:idle:state}.
     211The 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}.
    211212A \proc begins its idle sleep by adding itself to the idle list before searching for an \at.
    212213In 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.