ch2 - Chapter 2 Processes & Threads Concurrency:...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Concurrency: processes & threads 1 ©Magee/Kramer 2 nd Edition Chapter 2 Processes & Threads
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Concurrency: processes & threads 2 ©Magee/Kramer 2 nd Edition concurrent processes We structure complex systems as sets of simpler activities, each represented as a sequential process . Processes can overlap or be concurrent, so as to reflect the concurrency inherent in the physical world, or to offload time-consuming tasks, or to manage communications or other devices. Designing concurrent software can be complex and error prone. A rigorous engineering approach is essential. Model processes as finite state machines. Program processes as threads in Java. Concept of a process as a sequence of actions.
Background image of page 2
Concurrency: processes & threads 3 ©Magee/Kramer 2 nd Edition processes and threads Concepts : processes - units of sequential execution. Models : finite state processes (FSP) to model processes as sequences of actions. labelled transition systems (LTS) to analyse, display and animate behavior. Practice : Java threads
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Concurrency: processes & threads 4 ©Magee/Kramer 2 nd Edition 2.1 Modeling Processes Models are described using state machines, known as Labelled Transition Systems LTS . These are described textually as finite state processes ( FSP ) and displayed and analysed by the LTSA analysis tool. LTS - graphical form FSP - algebraic form
Background image of page 4
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. a light switch LTS on off on off on off ………. a sequence of actions or trace on off 0 1 Can finite state models produce infinite traces?
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
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) Convention: actions begin with lowercase letters PROCESSES begin with uppercase letters once 0 1
Background image of page 6
Concurrency: processes & threads 7 ©Magee/Kramer 2 nd Edition FSP - action prefix & recursion SWITCH = OFF, OFF = (on -> ON), ON = (off-> OFF). Repetitive behaviour uses recursion: Substituting to get a more succinct definition: SWITCH = OFF, OFF = (on ->(off->OFF)). And again: SWITCH = (on->off->SWITCH). on off 0 1
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Concurrency: processes & threads 8 ©Magee/Kramer 2 nd Edition animation using LTSA Ticked actions are eligible for selection. In the LTS, the last action is highlighted in red. The LTSA animator can be used to produce a trace. on of f 0 1
Background image of page 8
Concurrency: processes & threads 9 ©Magee/Kramer 2 nd Edition FSP - action prefix TRAFFICLIGHT = (red->orange->green->orange -> TRAFFICLIGHT).
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 36

ch2 - Chapter 2 Processes & Threads Concurrency:...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online