- concurrent traces
- a concurrent computation is set of sequential computations
- the sequential computations must interact, although not all the time
- let them execute at the same time, but what does that mean
- the interleaved model of concurrent execution
- roll an n-sided die, execute an action from the corresponding
sequential computation
- however, any method may be possible, including sequential execution
- two problems - interference and synchronization
- interference
- the critical references in two actions
- a write reference in one and a read or write reference in the other
- a read reference in one and a write reference in the other.
- two actions without critical references may be executed concurrently
- they are independent of one another - nothing in common
- two actions with one critical reference may be executed concurrently
- something in common, but so what
- synchronization
- the processes are coordinating to solve a problem - produce-consumer
programs
- the coordination condition may involve critical references
- two solutions - atomicity and waiting
- atomicity
- atomic actions do not coincide
- atomicity solves interference - atomic actions have no critical
references
- an atomic action may read and write variables without interruption
- at most once actions appear to be atomic - they are limited,
however
- actions in a execution trace should be atomic - the granularity will
vary
- the finer the granularity, the greater the concurrency
- the larger the granularity, the easier to design
- angle brackets
<>
enclose an atomic action
- condition waiting
- the
wait
B statement - execution does not pass until
B is true
- think of it as
while (B) ;
but more efficient (spin looping)
- B may contain critical references (may? probably!)
- the await statement - combine synchronization and atomiticiy
- concurrent programs need to
- creating larger-grain atomic actions
- wait for other processes
- examples
- the atm problem - moving money from savings to checking
- manipulating a linked list
- the await statement provides both atomicity and synchronization
-
<wait b; s>
- atomically evaluate
b
- if
b
is true, execute s
in the same atomic action; go on
to the following statement
- if
b
is false, abandon execution and remain at the await.
- the delay condition
wait b
indicates synchronization - note the
atomic execution
- angle brackets
<>
indicate atomic execution
- without the delay condition the await statement represents
unconditional atomic execution
- scheduling - which shall be next
- the scheduler determines which process gets to execute next
- fairness - every process gets to execute
- eligible statements - conditional and unconditional
- unconditional fairness - all unconditional atomic actions are
eventually executed
- weak fairness (justice) - always enabled conditional atomic actions are
eventually executed
- strong fairness - infinitely enabled conditional atomic actions are
eventually executed
- unconditional is simple and not useful; strong is hard and useful
This page last modified on 10 June 2002.