Send
Close Add comments:
(status displays here)
Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
Parallel programming using CSP
1. Parallel programming using CSP
2. CSP and guarded commands
CSP: Tony Hoare described CSP in 1978, part of which is based on guarded commands.
Dijkstra first described guarded commands as the basis of a nondeterministic language in 1975.
3. Assignment
4. Conditional
Nondeterministic conditional: pick any
guard that is true and execute the associated
statement-list (
abort if no guard is true).
if
<guard>1 -> <statement-list>1 ;
<guard>2 -> <statement-list>2 ;
...
<guard>n -> <statement-list>n ;
fi
5. Repetition
Nondeterministic loop: pick any
guard that is true and execute the associated
statement-list (
skip when no guard is true).
do
<guard>1 -> <statement-list>1 ;
<guard>2 -> <statement-list>2 ;
...
<guard>n -> <statement-list>n ;
od
6. CSP
Communicating sequential processes, or CSP, notation:
7. Parallel assignment
Parallel assignment:
v1, v2, ..., vn := e1, e2, ..., en
8. Messages
Send
message to process
pi:
pi ! <message>
Receive
message from process
pj:
pj ? <message>
9. Exercises
Exercises: Write CSP programs to do the following.
swap values of variables x and y
set z to the maximum of x and y
10. End of page