11
Cohesive Programming for Distributed Systems: Matching the programming model to the conceptual model John A. Thywissen • Arthur Peters 26 March 2014

John A. Thywissen •  Arthur Peters 26 March 2014

  • Upload
    delu

  • View
    23

  • Download
    0

Embed Size (px)

DESCRIPTION

Cohesive Programming for Distributed Systems: Matching the programming model to the c onceptual model. John A. Thywissen •  Arthur Peters 26 March 2014. Some distributed problems are cohesive. - PowerPoint PPT Presentation

Citation preview

Page 1: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Cohesive Programming for Distributed Systems:

Matching the programming modelto the conceptual model

John A. Thywissen • Arthur Peters26 March 2014

Page 2: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Some distributed problems are cohesive

def attemptRegistration() = username = askUser(“Pick a username”) if isLegal(username)    and isUnique(username) then   createNewUser(username) else   displayError(username)

A cohesive distributed activity is conceptually an individual operation

2

Page 3: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Current techniques shatter cohesion

def attemptRegistration() = username = askUser(“Pick a username”)

 def callback(success) =   if not success   then     displayError(username)

 if isLegal(username) then   createIfUnique(username, callback) else   callback(false)

remote def createIfUnique(username)

remote def createIfUnique(username) = if isUnique(username) then   createNewUser(username)   return true else   return false

3

Browser Server

Page 4: John  A. Thywissen  •  Arthur  Peters 26  March  2014

dOrc programs are cohesiveServer

Browser

Distributed Orc = dOrc

4

dOrc

def attemptRegistration() = username = askUser(“Pick a username”) if isLegal(username)    and isUnique(username) then   createNewUser(username) else   displayError(username)

Page 5: John  A. Thywissen  •  Arthur  Peters 26  March  2014

username

Execution of dOrc example

askUser

usernameb

isUniquedisplayError createNewUser

username = askUser(“Pick a username”)b = isUnique(username)if b then createNewUser(username) else displayError(username)

5

Page 6: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Values have location and policy sets

𝓁t(v) = { A, B }𝓅(v) = { A, B, C }

Invariant: ∀v.∀t. 𝓁t(v) (⊆ 𝓅 v)

6

v vA B

C D

Page 7: John  A. Thywissen  •  Arthur  Peters 26  March  2014

The call site rule uses policy sets

For a call: M(x1, ..., xn)

P = (𝓅 M) ∩ (𝓅 x1) ∩ ... ∩ (𝓅 xn)

Move to any location in P and execute.Fail if there is no such location.

7

v vA B

C D

Page 8: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Optimization opportunities aboundFor a call: M(x1, ..., xn)Avoid communication

Lt = 𝓁t(M) ∩ 𝓁t(x1) ∩ ... ∩ 𝓁t(xn)

∀t. 𝓁t(+) = All locations

transform.applyTo(image) sizeof(transform) sizeof(≪ image)

v vA B

C D

8

Page 9: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Optimization opportunities abound

x = 1 + 2displayError(x)

x = f(y)M(x)

9

username = askUser(“Pick a username”)move to server with usernameb = isUnique(username)if b then createNewUser(username) move to browser else move to browser displayError(username)

Page 10: John  A. Thywissen  •  Arthur  Peters 26  March  2014

The right people and right place

10

Plan Phases Semantics Implementation Demonstration

Resources Existing Orc Token Semantics

Existing Orc Implementation and Optimizer

Building Wide Intelligence Project

Support Jayadev MisraWilliam Cook

Işıl DilligLorenzo Alvisi

Peter Stone

Personal experience in all three phases

Page 11: John  A. Thywissen  •  Arthur  Peters 26  March  2014

Cohesive Programming for Distributed Systems

def attemptRegistration() = username = askUser(“Pick a username”) if isLegal(username) and isUnique(username) then createNewUser(username) else displayError(username)

P = (𝓅 M) ∩ (𝓅 x1) ∩ ... ∩ (𝓅 xn)Lt = 𝓁t(M) ∩ 𝓁t(x1) ∩ ... ∩ 𝓁t(xn)

11

username

askUser isUniquedisplayError createNewUser

username

x = f(y)M(x)