Changes in / [d54ede6:d5f5eb7]
- File:
-
- 1 edited
-
doc/theses/colby_parsons_MMAth/text/waituntil.tex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/colby_parsons_MMAth/text/waituntil.tex
rd54ede6 rd5f5eb7 321 321 Note, the expression inside a @waituntil@ clause is evaluated once at the start of the @waituntil@ algorithm. 322 322 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 foo336 \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 foo341 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar342 \end{cfa}343 While this approach is not general for many resources, it handles many basic cases.344 345 323 \begin{figure} 346 324 \begin{cfa} … … 359 337 \label{f:wu_example} 360 338 \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. 361 361 362 362 The \CFA @and@ semantics match the @and@ semantics of \uC \lstinline[language=uC++]{_Select}.
Note:
See TracChangeset
for help on using the changeset viewer.