1
Concurrency 1 – Introduction
Alexandre David
adavid@cs.aau.dk Credits for the slides: Claus Brabrand Jeff Magee & Jeff Kramer
Concurrency 1 Introduction Alexandre David adavid@cs.aau.dk - - PowerPoint PPT Presentation
Concurrency 1 Introduction Alexandre David adavid@cs.aau.dk Credits for the slides: Claus Brabrand Jeff Magee & Jeff Kramer 1 Course Teachers: Alexandre David adavid@cs.aau.dk Emmanuel Fleury fleury@cs.aau.dk Page:
1
adavid@cs.aau.dk Credits for the slides: Claus Brabrand Jeff Magee & Jeff Kramer
2
➢ Teachers:
– Alexandre David adavid@cs.aau.dk – Emmanuel Fleury fleury@cs.aau.dk
➢ Page: http://www.cs.aau.dk/~adavid/teaching/MTP-05/ ➢ Lectures:
3
➢ Concurrency – State Models and Java
➢ Other useful books, see on the web site [3]
➢ Other materials:
– slides – photocopies – recommended readings on the web
4
5
➢ Story: Between 1985 and 1987, a computer
➢ Lesson: If you are going to design Therac-26,
6
➢ Concurrent programming is used in a wide
– life critical – money critical – important for quality of life
➢ This course is about the principles and
➢ It is useful even if you don't design Therac-
7
➢ Example: activities involved in building a
➢ It is similar for computer programs:
➢ Concurrent programs are often interleaved.
8
➢ Sequential program: one
– sequential computations only
➢ Concurrent program: one or
– multiple computations in parallel – control of several activities at the
9
➢ Performance gain from multiprocessing
– parallelism – future of computing (multi-core CPU)
➢ Increased application throughput
– I/O calls block only their threads
➢ Increased application responsiveness
– high priority threads for user requests – reactive systems
10
➢ More appropriate program structure
– concurrency reflected in programs
➢ But it is more difficult to reason about
– shared resources – mutual exclusion – preemption – precedence constraints – how to write and debug!!! – etc...
11
➢ Therac-25: concurrent programming error
➢ Mars Rover: problems with interaction
➢ We need to be rigorous.
12
➢ Requirements: controlled by 3 buttons
➢ How to design such a program? ➢ How to ensure the programs meets its
➢ How to define the specifications? ➢ How to define unsafe behaviours?
13
Cruise control buttons
14
➢ What you would do:
– use your own experience and design it as best as
– test it with a simulator of some kind, use a
➢ Testing is difficult: how much testing do we
➢ Note: concurrent events may occur in any
15
➢ A model is a simplified representation of the
➢ Based on Labelled Transition Systems (LTS) .
speed engineOff engineOn EngineOff EngineOn
16
➢ LTSA in Java provided on the
➢ Animation of models to
➢ Mechanical verification of
17
➢ States: indicate in which states the system is
➢ Transitions between states: when given events
➢ The point is to analyse the behaviour of the
➢ Analysis done by a model-checker. When
18
➢ Java used for the examples:
– widely available, accepted, and portable – provides good concurrency abstractions
➢ Later in the course, C:
– common on all operating systems
19
➢ Concepts: thorough understanding of
➢ Models: provide insight into concurrent
➢ Practice: programming practice and experience.
20
21
➢ Concepts:
➢ Models:
➢ Practice: