Modular Concurrency Peter Grogono Computer Science and Software - - PowerPoint PPT Presentation

modular concurrency
SMART_READER_LITE
LIVE PREVIEW

Modular Concurrency Peter Grogono Computer Science and Software - - PowerPoint PPT Presentation

Modular Concurrency Peter Grogono Computer Science and Software Engineering Concordia University 1 CUSEC 2006 2 CUSEC 2006 3 CUSEC 2006 public scope local inner classes protected scope anonymous inner classes private scope member


slide-1
SLIDE 1

Modular Concurrency

Peter Grogono

Computer Science and Software Engineering Concordia University

slide-2
SLIDE 2

CUSEC 2006

1

slide-3
SLIDE 3

CUSEC 2006

2

slide-4
SLIDE 4

CUSEC 2006

3

slide-5
SLIDE 5

public scope local inner classes protected scope anonymous inner classes private scope member inner classes package scope static member inner classes instance methods delegates static methods classes interfaces packages

CUSEC 2006

4

slide-6
SLIDE 6

CUSEC 2006

5

slide-7
SLIDE 7

CUSEC 2006

6

slide-8
SLIDE 8

class Foo

{

private int x = 0 private int y = 0 invariant y = 2 × x public void f()

{

x+ = 1 y + = 2

}

public void g()

{

x∗ = 3 y ∗ = 3

} }

CUSEC 2006

7

slide-9
SLIDE 9

Foo f g Bar h

CUSEC 2006

8

slide-10
SLIDE 10

class Foo

{

private int x = 0 private int y = 0 private Bar b invariant y = 2 × x public void f()

{

x+ = 1 b.h() y + = 2

}

public void g()

{

x∗ = 3 y ∗ = 3

} }

CUSEC 2006

9

slide-11
SLIDE 11

class Bar

{

private Foo f public void h()

{

f .g()

} }

CUSEC 2006

10

slide-12
SLIDE 12

Foo f g Bar h

CUSEC 2006

11

slide-13
SLIDE 13

x = 0 y = 0 x+ = 1 1 x∗ = 3 3 y ∗ = 3 y + = 2 2

CUSEC 2006

12

slide-14
SLIDE 14

serves various clients

  • ffers various services

logs activities

usage statistics state queries metastate queries (reflection)

state control:

start/stop/suspend/resume/·· · responds to tests

CUSEC 2006

13

slide-15
SLIDE 15

If I have seen farther than others, it is because I was standing on the shoulder of giants.

Isaac Newton

We should be standing on the shoulders, not the feet of those who worked on these problems.

Richard Fateman

CUSEC 2006

14

slide-16
SLIDE 16

James Gosling

CUSEC 2006

15

slide-17
SLIDE 17

Edsger Wybe Dijkstra

CUSEC 2006

16

slide-18
SLIDE 18

Charles Anthony Richard Hoare

CUSEC 2006

17

slide-19
SLIDE 19

Per Brinch Hansen

CUSEC 2006

18

slide-20
SLIDE 20

We have stipulated that processes should be connected loosely; by this we mean that apart from the (rare) moments

  • f

explicit intercommunication, the individual processes themselves are to be regarded as completely independent of each other.

Edsger Dijkstra

CUSEC 2006

19

slide-21
SLIDE 21

Michael Jackson #2

CUSEC 2006

20

slide-22
SLIDE 22

Michael Jackson #1

CUSEC 2006

21

slide-23
SLIDE 23

Born in the ice-blue waters of the festooned Norwegain coast; amplified (by an aberration of world currents, for which marine geographers have yet to find a suitable explanation) along the much grayer range of the Californian Pacific; viewed by some as a typhoon, by some as a tsunami, and by some as a storm in a teacup — a tidal wave is hitting the shores of the computing world.

Bertrand Meyer (1988)

CUSEC 2006

22

slide-24
SLIDE 24

Kristen Nygaard Ole-Johan Dahl

CUSEC 2006

23

slide-25
SLIDE 25

Alan Kay

CUSEC 2006

24

slide-26
SLIDE 26

Adele Goldberg

CUSEC 2006

25

slide-27
SLIDE 27

Barbara Liskov

CUSEC 2006

26

slide-28
SLIDE 28

The Best Part of Being an Engineer I find a career in engineering to be very satisfying. I like making things work. I also like finding solutions to problems that are both practical and elegant. And, I like working with a team of people; engineering involves lots of team work.

Barbara Liskov

CUSEC 2006

27

slide-29
SLIDE 29

It is astounding to me that Java’s insecure parallelism is taken seriously by the programming community, a quarter of a century after the invention of monitors and Concurrent Pascal. It has no merit. Although the development of parallel languages began around 1972, it did not stop there. Today we have three major communication paradigms: monitors, remote procedures, and message passing. Any one of them would have been a vast improvement over Java’s insecure variant

  • f shared classes.

As it is, Java ignores the last twenty-five years of research in parallel languages.

Per Brinch Hansen (1999)

CUSEC 2006

28

slide-30
SLIDE 30

You can blame some of this model inaccuracy

  • n the extremely detailed and sensitive nature
  • f current programming language technologies.

Minor lapses and barely detectable coding er- rors, such as misaligned pointers or uninitialized variables, can have enormous consequences. . . . If such seemingly minute detail can have such dire consequences, how can we trust models to be accurate, since models, by definition, are supposed to hide or remove detail?

Bran Selic

CUSEC 2006

29

slide-31
SLIDE 31

Recent work in concurrent programming

⋆ Joyce Per Brinch Hansen ⋆ Hermes IBM ⋆ Oz Seif Haridi and Nils Franz´ en ⋆

  • ccam-π

Fred Barnes et al. ⋆ Separation Logic John C. Reynolds et al.

CUSEC 2006

30

slide-32
SLIDE 32

Assorted ideas:

  • 1. A component is a cell running a multithreaded process
  • 2. Cells exchange data
  • 3. A cell gets exactly the capabilities that it needs
  • 4. Semantics is decoupled from deployment
  • 5. Programs are scale-free
  • 6. Tests are part of the code

CUSEC 2006

31

slide-33
SLIDE 33

CUSEC 2006

32

slide-34
SLIDE 34

CUSEC 2006

33

slide-35
SLIDE 35

CUSEC 2006

34

slide-36
SLIDE 36

CUSEC 2006

35

slide-37
SLIDE 37

public static void main(String[] args)

{

.... Random generator = new Random(); ....

CUSEC 2006

36

slide-38
SLIDE 38

import java.util.Random; public static void main(String[] args)

{

.... Random generator = new Random(); ....

CUSEC 2006

37

slide-39
SLIDE 39

Syntax Semantics Implementation

CUSEC 2006

38

slide-40
SLIDE 40

Syntax Semantics Deployment

CUSEC 2006

39

slide-41
SLIDE 41

income := salary() - fed.tax() - prov.tax()

CUSEC 2006

40

slide-42
SLIDE 42

CUSEC 2006

41

slide-43
SLIDE 43

abstract type MessageProtocol = []; type SumProtocol = MessageProtocol[p, q: int; result: *int]; type Sum = [ main: process(init: *SumProtocol) = var params: SumProtocol; init ? params; params.result ! move params.p + params.q end ]

CUSEC 2006

42

slide-44
SLIDE 44

var initProtocol: **SumProtocol; new Sum({}) ! alias initProtocol; var sumFunction: *SumProtocol; initProtocol ? sumFunction; var return: *int; sumFunction ! copy (2, 3, alias return); var x: int; return ? x

CUSEC 2006

43

slide-45
SLIDE 45

type Sum = [ main: process(p, q: int; result: *int) = result ! move p + q end ] var return: *int; Sum({}) ! copy (2, 3, alias return); var x: int; return ? x

CUSEC 2006

44

slide-46
SLIDE 46

Conclusions 1

  • 1. Object Oriented programming has had a good run, but

even the best shows don’t last forever

  • 2. Concurrent programming,

after lurking in the wings for decades, is moving to centre stage

  • 3. One play, many shows

CUSEC 2006

45

slide-47
SLIDE 47

Conclusions 2

  • 1. Learn the tools of your trade
  • 2. Trust your intuition
  • 3. Question the foundations

CUSEC 2006

46