


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to concurrent processes, their modeling using Finite State Processes (FSP), and analysis using tools like LTSA. Topics covered include process modeling as finite state machines, action prefix, recursion, choice, non-deterministic choice, modeling failure, indexed processes and actions, guarded actions, and LTS to FSP transformation.
Typology: Study notes
1 / 26
This page cannot be seen from the preview
Don't miss anything!



















Ryszard Janicki
Department of Computing and Software, McMaster University, Hamilton, Ontario, Canada
Concurrent process is a composition of sequential processes. Hidden assumption: Concurrent systems can be decomposed into sequential systems.
(^1) Process (sequential): A sequence of action ↓ (^2) Model of a process: Finite state machine ↓ (^3) A possible implementation of processes: Threads in Java. The approach 1,2,3 is not the only one, but we will concentrate on it in this course.
A process is the execution of a sequential program. It is modeled as a finite state machine which transits from state to state by executing a sequence of atomic actions.
Concurrency: processes & threads 5 ©Magee/Kramer 2 nd^ Edition
modeling processes
A process is the execution of a sequential program. It is modeled as a finite state machine which transits from state to state by executing a sequence of atomic actions. on
off
a light switch LTS
a sequence of on Æ off Æ on Æ off Æ on Æ off Æ ………. actions ortrace
Can finite state models produce infinite traces? How can it be modelled by an algebraic expression?
If x is an action and P is a process then (x → P) describes a process that initially engages in the action x and then behaves exactly as described by P.
Concurrency: processes & threads 6 ©Magee/Kramer 2 nd^ Edition
FSP - action prefix
If x is an action and P a process then (x-> P) describes a process that initially engages in the action x and then behaves exactly as described by P.
ONESHOT = (once -> STOP). (^) ONESHOT state machine (terminating process)
once
0 1
Convention: actions begin with lowercase letters PROCESSES begin with uppercase letters
Convention: actions begin with lowercase letters while PROCESSES begin with uppercase letters
Concurrency: processes & threads 9 ©Magee/Kramer 2 nd^ Edition
FSP - action prefix
FSP model of a traffic light : TRAFFICLIGHT = (red->orange->green->orange -> TRAFFICLIGHT).
red orange green
orange
Trace: red Æ orange Æ green Æ orange Æ red Æ orange Æ green …
If x and y are actions then (x → P | y → Q) describes a process which initially engages in either of the actions x or y. After the first action has occurred, the subsequent behavior is described by P if the first action was x and Q if the first action was y.
Concurrency: processes & threads 11 ©Magee/Kramer 2 nd^ Edition
FSP - choice FSP model of a drinks machine : DRINKS = (red->coffee->DRINKS |blue->tea->DRINKS ). LTS generated usingLTSA:
Possible traces?
red
blue
coffee tea
0 1 2
Ryszard Janicki Concurrent Processes 8/
How do we model an unreliable communication channel which accepts in actions and if a failure occurs produces no output, otherwise performs an out action?
Concurrency: processes & threads 13 ©Magee/Kramer 2 nd^ Edition
Modeling failure
How do we model an unreliable communication channel which accepts in actions and if a failure occurs produces no output, otherwise performs an out action?
Use non-determinism...
CHAN = (in->CHAN |in->out->CHAN ).
in
in
out
0 1
Single slot buffer that inputs a value in the range 0 to 3 and then outputs that value.
Concurrency: processes & threads 14 ©Magee/Kramer 2 nd^ Edition
FSP - indexed processes and actions
Single slot buffer that inputs a value in the range 0 to 3 and then outputs that value: BUFF = (in[i:0..3]->out[i]-> BUFF). equivalent to
or using a process parameter with default value:
BUFF = (in[0]->out[0]->BUFF |in[1]->out[1]->BUFF |in[2]->out[2]->BUFF |in[3]->out[3]->BUFF ).
indexed actions generate labels of the form action. index
BUFF(N=3) = (in[i:0..N]->out[i]-> BUFF).
The choice (when B x → P | y → Q) means that when the guard B is true then the actions x and y are both eligible to be chosen, otherwise if B is false then the action x cannot be chosen.
Concurrency: processes & threads 16 ©Magee/Kramer 2 nd^ Edition
FSP - guarded actions
The choice (when B x -> P | y -> Q) means that when the guard B is true then the actions x and y are both eligible to be chosen, otherwise if B is false then the action x cannot be chosen.
COUNT (N=3) = COUNT[0], COUNT[i:0..N] = (when(i<N) inc->COUNT[i+1] |when(i>0) dec->COUNT[i-1] ). inc inc
dec
inc
dec dec
It usually occurs in the form (when B x → P | when ¬B y → Q), so the choice between x → P and y → Q is exclusive.
A countdown timer which beeps after N ticks, or can be stopped.
Concurrency: processes & threads 17 ©Magee/Kramer 2 nd^ Edition
FSP - guarded actions A countdown timer which beeps after N ticks, or can be stopped. COUNTDOWN (N=3) = (start->COUNTDOWN[N]), COUNTDOWN[i:0..N] = (when(i>0) tick->COUNTDOWN[i-1] |when(i==0)beep->STOP |stop->STOP ).
start
stop
tick
stop
tick
stop tick beep
stop
0 1 2 3 4 5 COUNTDOWN ↑ COUNTDOWN[2] ↑ COUNTDOWN[0] STOP COUNTDOWN[3] COUNTDOWN[1]
A = (a → b → B | b → (a → c → A | b → B)) B = (a → c → (a → A | b → b)) often some parentheses can be omitted for readability, i.e., we may write: A = a → b → B | b → (a → c → A | b → B) B = a → c → (a → A | b → B) ———————————————————————————– B 1 = b → B A 1 = c → A D 1 = a → A 1 | b → B A = a → B 1 | b → D 1 B 2 = a → A | b → B A 2 = c → B 2 B = a → A 2
The alphabet of a process is the set of actions in which it can engage. Process alphabets are implicitly defined by the actions in the process definition. Alphabet extension can be used to extend the implicit alphabet of a process: WRITER = (write[1] → write[3] → WRITER) + {write[0..3]} Alphabet of WRITER is the set {write[0..3]} = {write[0], write[1], write[2], write[3]}.
Concurrency: Logically simultaneous processing.Does not imply multiple processing elements (PEs). Requires interleaved execution on a single PE. Parallelism: Physically simultaneous processing.Involves multiple PEs and/or independent device operations. The textbook uses the terms parallel and concurrent interchangeably and generally do not distinguish between real and pseudo-concurrent execution. These are the authors definitions! They are NOT universally accepted! WHAT ABOUT SIMULTANEITY AND SIMULTANEOUS EXECUTIONS?! They may make a substantial difference!
How should we model process execution speed? Arbitrary speed (we abstract away time) How do we model concurrency? Arbitrary relative order of actions from different processes (interleaving but preservation of each process order) !!? MANY CONSIDER THIS APPROACH AS AN OVERSIMPLIFICATION! What is the result? It provides a general model independent of scheduling (asynchronous model of execution) !!? MANY CONSIDER THE LAST STATEMENT AS AN UNJUSTIFIED OVERSTATEMENT!