Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Nondeterminism
1. Nondeterminism
2. Parallel operations
Hardware operations are parallel if they overlap in time.
Software operations are concurrent if they can be executed in parallel. Concurrency is potential for parallelism.
Operations that occur one after the other in time are sequential.
3. Deterministic
Deterministic - given a computer state, the next action can be determined.
4. Nondeterministic
Nondeterministic - given a computer state, the next action can not be determined. Source of nondeterminism:
Random numbers
User input
Concurrent systems
5. Sequential actions
Process - sequential computation, with its own thread of control. Process interaction:
6. Non-sequential actions
Communication - exchange of data between processes, often by messages or shared variables.
Synchronization - relates the thread of one process with that of another (certain actions cannot be performed until certain conditions are met).
Competition - processes compete for a resource (plane reservation system).
Cooperation - processes work together to solve a problem.
7. Heisenbugs
8. Physics history
Physics history:
Heisenberg's uncertainty principle (simplified) is that the act of measuring can change what you are measuring.
Bohr's theory of the atomic structure is more straightforward.
9. Bug types
Bohr-bugs are bugs in deterministic programs (one thing done at a time, the same way each time)
Heisen-bugs are bugs in nondeterministic programs (distributed, time dependent, nothing happens the same twice)
10. Troubleshooting
Troubleshooting hardware and software:
problem is reproducible under a given set of conditions (Bohr-bug): usually software problem
problem is pretty much random (Heisen-bug): hardware problem
11. Parallel programming
12. CSP
CSP: Tony Hoare described
CSP (
Communicating Sequential Processes) in 1978, part of which is based on guarded commands.
Dijkstra first described
guarded commands as the basis of a nondeterministic language in 1975.
13. Assignment
14. 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
15. 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
16. CSP
Communicating sequential processes, or CSP, notation:
17. Parallel assignment
Parallel assignment:
v1, v2, ..., vn := e1, e2, ..., en
18. Messages
Send
message to process
pi:
pi ! <message>
Receive
message from process
pj:
pj ? <message>
19. 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
20. End of page
21. Acronyms and/or initialisms for this page
1 acronyms omitted (login required)