Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unifying Theories Execution History Tony Hoare In honour of Manfred Broy 30 October 2009.

Similar presentations


Presentation on theme: "Unifying Theories Execution History Tony Hoare In honour of Manfred Broy 30 October 2009."— Presentation transcript:

1 Unifying Theories Execution History Tony Hoare In honour of Manfred Broy 30 October 2009

2

3 Manfred Broy and Tony Hoare at Marktoberdorf.

4 Unifying… Memory – shared/private, weakly/strongly consistent Communication – synchronised/buffered, reliable/unreliable Resource management – dynamic/nested, disposed/collected

5 Unifying… Sequential programming – C, Java, C#,... Process algebras and calculi – stream processing functions – CCS, CSP, pi Shared memory, threads – fine-grained, coarse-grained, transactions – weakly consistent memory

6 Labelled graphs Trace semantics(Mazurkiewicz) Regular expressions(Kleene) Causal nets(Petri) Event structure configurations(Winskel) Message Sequence Charts(UML) INSIGHT! They are all labeled graphs

7 A labeled Graph E: a set of nodes (events) A: a set of arrows (denoting data flow) L: a set of labels (to be determined) source, target: A -> E label: A -> L (labelling the arrow) label: E -> L (labelling the events)

8 Program Execution is recorded as a trace of all events that have occurred – drawn as boxes all dependencies between them – drawn as arrows source target – the target could not occur before source

9 Program Execution is recorded as a trace of: all events that have occurred – drawn as boxes – with labels naming the executed command all dependencies between them – drawn as arrows source target – with labels naming resource.value, etc. x := 3 x.3 x := 3x = 3

10 A Sequential Resource begin end next

11 Implementation begin end next allocated globally/on stack/in heap/… disposed from stack/by command/by collector/by OS

12 Fork fanout all arrows of the graph have the same source

13 Join fanin all arrows of the graph have the same target

14 Shared Resource faninfanout begin end

15 Publication faninfanout publish next

16 Assignment fanin fanout := 3 := 7 next =3

17 A variable begin end next := fanin fanout = = ==

18 A variable begin end next := fanin fanout = = ==

19 A variable begin end next := fanin fanout = = ==

20 A variable begin end next := fanin fanout = = ==

21 A variable begin end next := fanin fanout = = ==

22 A variable begin end next := fanin fanout = = ==

23 A variable begin end next := fanin fanout = = ==

24 Unassigned fetch begin end next := fanin fanout fanin fanout

25 Communication !!! ? ?? send

26 Ordering next !!! ? ?? send

27 Channel next !!! ? ?? end begin next send

28 Single-buffered Channel next !!! ? ?? end begin next send sync

29 Synchronised next !!! ? ?? end begin next send sync

30 Lossy channel next !!! ? ? send

31 Stuttering channel next !! ? ?? send

32 Fraudulent channel next !! ? ?? send

33 Overtaking next !! ?? send

34 Reliable channel reliable =  loss &  fraud &  stutter &  merge &  overtaking

35 Threads fork begin end next begin next join begin next end fork join

36 An Atomic Assignment x := x + y x = 3 y= 4 x := 7

37 An Atomic Assignment x := x + y x = 3 y= 4 x := 7 x.fanout.3x.fanin y.fanout.4 y.fanin x.next x.fanout.7 x.fanin t.next

38 An Atomic Assignment x := x + y x = 3 y= 4 x := 7 x.fanout.3x.fanin y.fanout.4 y.fanin x.next x.fanout.7 x.fanin t.next

39 Events and atomic actions Each occurrence of an event in the trace of program execution belongs to the trace of exactly one resource (thread, variable, channel,…) Atomic actions are groups of synchronised events, including exactly one from the thread which invoked the action, and one (or more) from every resource used by it.

40 v.fanout v:= 4 v := 3v:= 6 v.next v.fanin v.fanout v.fanin =3 = 4= 6 v.next A variable (fully labelled) v.fanout

41 t.next v:= 4 v := 3v:= 6 thread t interfering thread v.next =3 = 4= 6 v.next A shared variable v.next

42 Weakly consistent memory as implemented in multi-core architecture, is even more complicated to define … and more still to use! A common architecture is TSO

43 Total Store Ordering :=4 sync :=3 :=6global memory sync

44 Local memory next val next :=4 sync :=3 :=6 := 4:= 3:= 6 local memory global memory sync

45 Local memory access next val next :=4 sync :=3 :=6 := 4:= 3:= 6 local memory global memory = 3= 4= 6 local memory sync

46 next val next :=4 sync :=3 :=6 := 4:= 3:= 6 local memory global memory other thread :=4 = 3= 4= 6 local memory sync :=3

47 Memory Barrier next val next sync :=4 :=3 :=6 := 4:= 3:= 6bar local memory global memory

48 Summary Dependency and data flow are a primitive concepts adequate to describe the dynamic behaviour of many kinds of computing resource Labelled graphs provide a general framework adequate for a unifying theory of dependency


Download ppt "Unifying Theories Execution History Tony Hoare In honour of Manfred Broy 30 October 2009."

Similar presentations


Ads by Google