• Aucun résultat trouvé

Reductions and Causality (1)

N/A
N/A
Protected

Academic year: 2022

Partager "Reductions and Causality (1)"

Copied!
30
0
0

Texte intégral

(1)

Reductions and Causality (1)

[email protected] Tsinghua University,

October 31, 2011

http://pauillac.inria.fr/~levy/courses/tsinghua/reductions

(2)

Plan

independent statements

control flow

relaxed control flow

data dependencies

parallel processes

functional languages and multi-threading

(3)

Weak memory

models

(4)

Intel whitepaper (1/3)

Demo1

(5)

Intel whitepaper (2/3)

Demo2

(6)

Intel whitepaper (3/3)

Demo3

(7)

Causality

Computations steps may be independent

Others are causally related

Refined to memory accesses

Theory of causality ?

- reductions steps in the λ-calculus (this course)

- event structures (processes)

- true concurrency

- slicing (program analysis)

- etc.

(8)

Intel 64 revisited (1/4)

In SC (sequentially consistent), program order is strictly respected

(9)

Intel 64 revisited (2/4)

Dependency relations

rf R is read from relation W

po B is program order A

ws W is write serialization (acyclic) relation W

R fr W is from read relation when there is W’ such that

rf R and

W’ W’ ws W

(10)

Intel 64 revisited (3/4)

In TSO, W followed by R can be relaxed within program order

(11)

Intel 64 revisited (4/4)

In TSO, W followed by R is relaxed

In PSO, W followed by W to distinct location is relaxed

(12)

WMM

(13)

WMM and optimization (1/2)

(14)

WMM and optimization (2/2)

[Vafeiadis, Zappa Nardelli] SAS/2010

(15)

Parallel computations

(16)

Pure functional languages (1/2)

Evaluations of subexpressions are independent

M M

1

M

2

· · · M

n

Evaluations of M and Mi can be done in parallel

No longer true if effects within some of Mi

-In Haskell, monads are the only effect-ful subterms

- monads may call pure functional terms

- pure functional terms cannot call monads

- effects are visible in types

In other languages, static analysis necessary to detect effects

(17)

Pure functional languages (2/2)

Inside functional languages, there exists dependencies

Evaluations in M has to be done before toplevel redex

M N ( x . P )Q P { x := Q }

I = x .x

where

I I (Ia) I (Ia) Ia

(18)

CCS or π -calculus (1/3)

Communications may be independent

but other transitions may be causally related

a 0 | b 1 | a(x ).P | b (x ).Q

a 0 | a(x ).P | Q { x := 1 } b 1 | P { x := 0 } | b(x ).Q

P { x := 0 } | Q { x := 1 }

[Jean Krivine] (reversible CCS)

(19)

CCS or π -calculus (2/3)

example of causally related transitions

a 0 | a(x ).b(y ).P | b 1

b(y ).P { x := 0 } | b 1

P { x := 0, y := 1 }

causality in process algebras == event structures or Petri nets

causality in process algebras == event structures or Petri nets

« true concurrency »

[Winskel, Boudol-Castellani]

(20)

CCS or π -calculus (3/3)

possible conflicts

causality in process algebras == event structures or Petri nets

a 0 | b 1 | a(x ).P | a(y ).Q

b 1 | P { x := 0 } | a(y ).Q b 1 | a(x ).P | Q { y := 0 }

#

(21)

Security

(22)

Non interference

Private and Public expressions

when P is public and M, N are private

C [M ] P C [N ] P

Computations in M do not interfer on result P

[Volpano-Smith, Pottier-Simonet, Boudol]

... information flow

(23)

λ-calculus

(24)

Independent reductions (1/3)

In the λ-calculus, there are no conflicts (Church-Rosser thm)

M

N P

Q

Need closer look at reduction steps and notice when they can be permuted

(25)

Independent reductions (2/3)

permutation of reduction steps (nested redexes)

permutation of reduction steps (disjoint redexes)

( x .x (Ix ))(Ia) ( x .xx )(Ia)

( x .x (Ix ))a ( x .xx )a

( x .x (Ix ))(Ia) Ia (I (Ia))

( x .xx )(Ia) Ia (Ia)

(26)

Independent reductions (3/3)

problem: copies of redexes

( x .xx )(Ia) Ia (Ia) a (Ia) ( x .xx )a a a

how to define easily equivalence by permutations ?

(27)

Exercices

(28)

























Exercice

Show reductions equivalent by permutations in following reduction graph

(29)







 





































Show reductions equivalent by permutations in following reduction graph

(30)

Show reductions equivalent by permutations in following reduction graph

Références

Documents relatifs

This paper will define ethical hacking, list some of the commonly use terms for attackers, provide a list of the standard services offered via ethical hacking to combat

The lambda-calculus is more directly connected to functional languages (Lisp, Scheme, SML, Ocaml, Haskell), but its type theory inspired many other languages (Java, C#, F#, Scala)..

• we replaced occurences by giving names (labels) to

• Similar to parallel moves lemma, but we considered particular inside-out reduction strategy... Parallel steps

• highly exponential in the handling of fans node (not elementary recursive) [Asperti, Mairson 2000]. • nice algorithms unsharing paths to bound variables [Wadsworth

• Need closer look at reduction steps and notice when they can

• permutations of derivations are defined with critical pairs. • critical pairs

• Exercice 4: Complete all proofs of propositions. • Exercice 5: Show equivalent