John A. Thywissen •  Arthur Peters 26 March 2014

Post on 22-Feb-2016

24 views 0 download

Tags:

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

transcript

Cohesive Programming for Distributed Systems:

Matching the programming modelto the conceptual model

John A. Thywissen • Arthur Peters26 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

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

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)

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

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

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

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

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)

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

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)