qBeta has the following concurrency primitives:
R.suspend
R.attach
R.attach(exp)
- R.resume
M.cmpAndSwap(exp)
where M is an integerfork(R)
We need to describe pattern Core
representing physical cores. Perhaps in the section on active objects?
Suspend
R.suspend
implies that execution of the object R
is suspended and control returns to the caller of R
.
R
must be an object on the execution stack.
Cooperative attach
R.attach
implies that execution of the object R
is resumed at the latest point of suspend
or if never executed, at the start of its statements.
Preemptive attach
R.attach(exp)
implies that execution of the object R
is resumed at the latest point of suspend or if never executed, at the start of its statements.
The expression exp
must evaluate to an integer value.
R
is preemptively suspended after exp
time units.
Resume
R.resume
… do we still have this one?
CmpAndSwap
M.cmpAndSwap(exp)
implies that the value of exp
is attempted to be assigned to M
. The expression exp
must evaluate to an integer value.
CmpAndSwap
is similar to the machine instructions available on many CPUs. A description will be supplied.
Fork
Fork(R)
implies that the object R
is attached to a Core
-object representing a physical core.
Grammar
<Concurrency-Primitives> ::= <Suspend>
| <Cooperative-Attach>
| <Preemptive-Attach>
| <Resume> | <CmpAndSwap> | <Fork>
<Suspend> ::= <Object-Denotation> '.' 'suspend'
<Cooperative-Attach> ::= <Object-Denotation> '.' 'attach'
<Preemptive-Attach> ::= <Object-Denotation> '.' 'attach' '(' <Integer-Evaluation> ')'
<Resume> ::= <Object-Denotation> '.' 'resume'
<CmpAndSwap> ::= <Integer-Object-Denotation> '.' 'CmpAndSwap' '(' <Integer-Evaluation> ')'
<Fork> ::= 'fork' '(' <Object-Denotation> ')'