Changeset d54ede6
- Timestamp:
- Aug 1, 2023, 10:52:34 PM (16 months ago)
- Branches:
- master
- Children:
- a867622
- Parents:
- d5f5eb7 (diff), 2cb15b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/colby_parsons_MMAth/text/waituntil.tex
rd5f5eb7 rd54ede6 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 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 323 345 \begin{figure} 324 346 \begin{cfa} … … 337 359 \label{f:wu_example} 338 360 \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 foo353 \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 foo358 waituntil( bar ) { ... } or waituntil( foo ) { ... } // prioritize bar359 \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.