Changes in / [d54ede6:d5f5eb7]


Ignore:
File:
1 edited

Legend:

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

    rd54ede6 rd5f5eb7  
    321321Note, the expression inside a @waituntil@ clause is evaluated once at the start of the @waituntil@ algorithm.
    322322
    323 \section{Waituntil Semantics}
    324 
    325 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.
    326 
    327 \subsection{Statement Semantics}
    328 
    329 The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam.
    330 The 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.
    332 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.
    333 \begin{cfa}
    334 future(int) bar, foo;
    335 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
    336 \end{cfa}
    337 The reason for these semantics is that prioritizing resources can be useful in certain problems, such as shutdown.
    338 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:
    339 \begin{cfa}
    340 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
    341 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar
    342 \end{cfa}
    343 While this approach is not general for many resources, it handles many basic cases.
    344 
    345323\begin{figure}
    346324\begin{cfa}
     
    359337\label{f:wu_example}
    360338\end{figure}
     339
     340\section{Waituntil Semantics}
     341
     342The @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
     346The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam.
     347The 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.
     349For 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}
     351future(int) bar, foo;
     352waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
     353\end{cfa}
     354The reason for this semantics is that prioritizing resources can be useful in certain problems, such as shutdown.
     355In 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}
     357waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo
     358waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar
     359\end{cfa}
     360While 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.