Changes in / [d5f5eb7:d54ede6]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/text/waituntil.tex

    rd5f5eb7 rd54ede6  
    321321Note, the expression inside a @waituntil@ clause is evaluated once at the start of the @waituntil@ algorithm.
    322322
     323\section{Waituntil Semantics}
     324
     325The @waituntil@ semantics has two parts: the semantics of the statement itself, \ie @and@, @or@, @when@ guards, and @else@ semantics, and the semantics of how the @waituntil@ interacts with types like locks, channels, and futures.
     326
     327\subsection{Statement Semantics}
     328
     329The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam.
     330The clauses have an exclusive-or relationship where the first available one is run and only one clause is run.
     331\CFA's @or@ semantics differ from ALT semantics: instead of randomly picking a clause when multiple are available, the first clause in the @waituntil@ that is available is executed.
     332For example, in the following example, if @foo@ and @bar@ are both available, @foo@ is always selected since it comes first in the order of @waituntil@ clauses.
     333\begin{cfa}
     334future(int) bar, foo;
     335waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
     336\end{cfa}
     337The reason for these semantics is that prioritizing resources can be useful in certain problems, such as shutdown.
     338In the rare case where there is a starvation problem with the ordering, it possible to follow a @waituntil@ with its reverse form, alternating which resource has the highest priority:
     339\begin{cfa}
     340waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
     341waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar
     342\end{cfa}
     343While this approach is not general for many resources, it handles many basic cases.
     344
    323345\begin{figure}
    324346\begin{cfa}
     
    337359\label{f:wu_example}
    338360\end{figure}
    339 
    340 \section{Waituntil Semantics}
    341 
    342 The @waituntil@ semantics has two parts: the semantics of the statement itself, \ie @and@, @or@, @when@ guards, and @else@ semantics, and the semantics of how the @waituntil@ interacts with types like locks, channels, and futures.
    343 
    344 \subsection{Statement Semantics}
    345 
    346 The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam.
    347 The clauses have an exclusive-or relationship where the first available one is run and only one clause is run.
    348 \CFA's @or@ semantics differ from ALT semantics: instead of randomly picking a clause when multiple are available, the first clause in the @waituntil@ that is available is executed.
    349 For example, in the following example, if @foo@ and @bar@ are both available, @foo@ is always selected since it comes first in the order of @waituntil@ clauses.
    350 \begin{cfa}
    351 future(int) bar, foo;
    352 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
    353 \end{cfa}
    354 The reason for this semantics is that prioritizing resources can be useful in certain problems, such as shutdown.
    355 In the rare case where there is a starvation problem with the ordering, it possible to follow a @waituntil@ with its reverse form, alternating which resource has the highest priority:
    356 \begin{cfa}
    357 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
    358 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar
    359 \end{cfa}
    360 While this approach is not general for many resources, it handles many basic cases.
    361361
    362362The \CFA @and@ semantics match the @and@ semantics of \uC \lstinline[language=uC++]{_Select}.
Note: See TracChangeset for help on using the changeset viewer.