Changeset 2cb15b0 for doc/theses/colby_parsons_MMAth/text
- Timestamp:
- Aug 1, 2023, 10:40:11 PM (20 months ago)
- Branches:
- master
- Children:
- d54ede6
- Parents:
- 210c737
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/colby_parsons_MMAth/text/waituntil.tex ¶
r210c737 r2cb15b0 313 313 Note, the expression inside a @waituntil@ clause is evaluated once at the start of the @waituntil@ algorithm. 314 314 315 \section{Waituntil Semantics} 316 317 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. 318 319 \subsection{Statement Semantics} 320 321 The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam. 322 The clauses have an exclusive-or relationship where the first available one is run and only one clause is run. 323 \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. 324 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. 325 \begin{cfa} 326 future(int) bar, foo; 327 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo 328 \end{cfa} 329 The reason for these semantics is that prioritizing resources can be useful in certain problems, such as shutdown. 330 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: 331 \begin{cfa} 332 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo 333 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar 334 \end{cfa} 335 While this approach is not general for many resources, it handles many basic cases. 336 315 337 \begin{figure} 316 338 \begin{cfa} … … 329 351 \label{f:wu_example} 330 352 \end{figure} 331 332 \section{Waituntil Semantics}333 334 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.335 336 \subsection{Statement Semantics}337 338 The @or@ semantics are the most straightforward and nearly match those laid out in the ALT statement from Occam.339 The clauses have an exclusive-or relationship where the first available one is run and only one clause is run.340 \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.341 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.342 \begin{cfa}343 future(int) bar, foo;344 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo345 \end{cfa}346 The reason for this semantics is that prioritizing resources can be useful in certain problems, such as shutdown.347 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:348 \begin{cfa}349 waituntil( foo ) { ... } or waituntil( bar ) { ... } // prioritize foo350 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar351 \end{cfa}352 While this approach is not general for many resources, it handles many basic cases.353 353 354 354 The \CFA @and@ semantics match the @and@ semantics of \uC \lstinline[language=uC++]{_Select}.
Note: See TracChangeset
for help on using the changeset viewer.