Communicating Sequential Processes (CSP) Flashcards
Explain:
Decomposition as basic idea of CSP?
The basic idea of CSP is to provide means to design systems which by their nature comprise of concurrent tasks which interact between each other and with the common environment of all of them.
Benefits of CSP decomposition?
Many traditional problems of concurrent programming can be avoided:
- interference
- mutual exclusion
- interrupts
- multithreading
- semaphores
These problems appear as properties of multithreaded, single process software and/or synchronization primitives needed for solving the same.
CSP as mathematical tool?
As mathematical tool it provides good formal foundation for avoidance of errors such as divergence, deadlock and non-termination.
With the mathematical foundation it is easier to achieve provable correctness.
Alphabet of events.
Alphabet of events is set of all possible events happening in relation to an object.
Examples:
- {choc, coin}
- {in1p, in2p, in5p, small, large, out1p}
Define:
Process
Process is defined as behavior patter of an object manifested as the series of events from the available alphabet associated with the object.
Notational conventions:
- lowercase words - events {a, b, choc}
- uppercase words - processes {X, Y, VMS}
- lowercase letters - event variables (x)
- uppercase letters - sets of events X, Y
- alphabet of process - αP
- αVMS = {coin, choc}
- process that neve engages with events of its alphabet - STOPA- STOPαVMS
Define:
Prefix
(x → P)
Pronounced **“x then P” **describes an object which first engages with event x and then behaves as described by P.
- alphabet of (x → P) and P is the same: α(x → P) = αP assuming x ∈ αP
Examples:
- (coin -> (choc -> (coin -> STOPαVMS)))
- (right -> up -> right -> up -> STOPαCTR)
(x -> y) and (P -> Q)
These forms are syntactically incorrect ways to write the prefix based description of behavior of an object.
P -> Q is not correct
(x -> y -> STOP) is the correct way to write the event sequence.
Recursive notation of processes (object behaviors).
Provides more compact notation for the processes which cycle through set of events.
Explain:
Recursive definition of the process
CLOCK = (tick -> CLOCK)
- αCLOCK = {tick}
- consider an object that does nothing but ticks.
- Second, consider an object that behaves exactly the same but is prefixed by a tick event (tick -> CLOCK)
This one can not be differentiated from the first one so: CLOCK = (tick -> CLOCK)
It provides potential for unbounded unfolding: (tick -> (tick -> tick -> (tick -> ….)))
Define:
guarded process description.
Process description that starts with a prefix is called guarded process description.
F(X) = (x -> X)
Define:
Process equation and uniqueness of its solution
If F(X) is a guarded process description expression containing process name X, and A is alphabet of X then
X = F(X)
has a unique solution with alphabet A.
This solution is something more convenient to denote as
µX:A • F(X)
read as “process X with alphabet A such that X = F(X)”
Example:
VMS = (coin -> (choc -> VMS))
vs
VMS = µX:{coin, choc} • (coin -> (choc -> X))
Second representation is a more formal definition of the same thing above expressing the alphabet and the expression used to recursively define it.
As well it defines it in an abstract way so that it doesn’t depend on a exact name so that it can be used in other equations.
Explain:
Reasoning behind the solutions of the guarded equations.
Claim that guarded equations have a solution and that it is unique can be justified through the substitutions.
Any finite amount of behavior can be expressed by substituting the process within the RHS of the equation.
If two objects have same bahavior until some period in time they are essentially same process.
Define:
choice
(x -> P | y -> Q)
“x then P choice y then Q”
By prefix and recursion we can just describe processes which are sequential.
Introduction of choice provides option to have different behavior based on the interaction of an object with its environment.
(x -> P | y -> Q) describes and object which first engages with event x or y and proceeds with the process P or Q respectively.
α(x → P | y → Q ) = αP provided {x, y} ⊆ αP and αP = αQ