wave technology

120
Wave Technology

Upload: jadyn

Post on 23-Feb-2016

83 views

Category:

Documents


0 download

DESCRIPTION

Wave Technology. Table of Contents. Introduction Getting Started with WAVE Programming The WAVE Language Rules Basic Space Navigation Mechanisms in WAVE Graphical representation of wave: SPREAD DIAGRAMS Wave and sequential programming Modeling inter-process communications. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Wave Technology

Wave Technology

Page 2: Wave Technology

2

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 3: Wave Technology

3

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 4: Wave Technology

Session 1: Introduction

Page 5: Wave Technology

Introduction

• Wave is a special model, language and technology for highly parallel, distributed and cooperative systems.

• Originally designed for dealing with virtual worlds represented as dynamical Knowledge Networks.

• Based on recursive programs (waves) spreading, replicating, and splitting in active dynamic knowledge networks.

Page 6: Wave Technology

Wave Technology

• Wave Language• Wave Interpreter• Interface to the Internet (UDP/IP)• Interface to Unix (Solaris/Linux)• A good collection of applications

Page 7: Wave Technology

WAVE Architecture in Networks

WAVE Kernel

UDP/IP

WAVE Protocol

UNIX OS

WAVE Interpreter (NI)

NI

NI

Network

Page 8: Wave Technology

Wave Technology• Maps the Internet into a simple, seamless,

productive global info infrastructure (middleware)

• Allows rapid development of cooperative, distributed applications over the info infrastructure

WAVE Knowledge Network

Physical Network (Internet)

WAVE Applications

Page 9: Wave Technology

Layered Organization of WAVE

WAVE Application Layer

Dynamic Track Layer

Knowledge Network Layer

Network (Internet) Layer

Page 10: Wave Technology

Wave Salient Features

• Cooperative, distributed activities (programming)

• Spatial navigation with high parallelism • Dynamic distributed control• High-level abstraction (Free from

implementation details)• Operating with information and physical

systems

Page 11: Wave Technology

ApplicationsComputing grid

Intelligent networks

Service & security management

Traffic management (Data, Road and Air)

Distributed gaming

Distributed robotics

Distributed simulation (e.g. battle-field)

Applications

Page 12: Wave Technology

12

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 13: Wave Technology

Session 2: Getting Started with WAVE Programming

Page 14: Wave Technology

Creation of elementary networks• Creating a single node:

CREATE ( DIRECT # a ) Short: CR (@#a)

a

CR(@#a)

Page 15: Wave Technology

Creation of elementary networks• Adding node b connected to node a by an unoriented link p:

DIRECT # a. CREATE ( p # b )Short: @#a.CR(p#b)

CR(p#b)

p

b

@#a.CR(p#b)a

Page 16: Wave Technology

Creation of elementary networks• Adding node c connected to node a by an oriented link p:

DIRECT # a. CREATE ( +q # c )Short: @#a.CR(+q#c)

CR(+q#c)

q

c

@#a.CR(+q#c)a

Page 17: Wave Technology

Creation of elementary networks• Incremental creation of the entire network by an integral

templateCREATE ( DIRECT # a. p # b, + q # c )

Short: CR ( @#a. p#b, +q#c )aCR ( @#a. p#b, +q#c )

p

b

CR (p#b)

c

CR (+q#c)

q

Page 18: Wave Technology

Elementary data retrieval from a network

• Printing neighbors of node a in parallel on different terminalsDIRECT #a. ANY # ANY. TERMINAL = CONTENT

Short: @#a. #. T = C

a @#a. #, T=C

p

b

#.T=C

c

#.T=C

q

T=CT=Cb c

Terminal 1 Terminal 2

Page 19: Wave Technology

• Returning results to node a before printingDIRECT #a. ANY # ANY. Ftransit = CONTENT. LINK #

PREDECESSOR. TERMINAL = FtransitShort: @#a. #.F=C.L#P.T=F

a@#a. #.F=C.L#P.T=F

p

b

#.F=C.L#P.T

=F

c

#.F=C.L#P.T=F

q

T=CT=C

L#P.T=FF=b

L#P.T=FF=c

T=FT=F

b c

Terminal

Elementary data retrieval from a network

Page 20: Wave Technology

Collecting distributed data in one list

• Collecting neighbors into a single list with its subsequent printing

DIRECT # a.SEQUENCE (

( ANY # ANY. Ftransit = CONTENT.Link # PREDECESSOR. Nlist & Ftransit),TERMINAL = Nlist

)

Short: @#a. SQ( (#. F=C. L#P. N&F), T=N )

Page 21: Wave Technology

@#a. SQ( (#. F=C. #P. N&F), T=N )

a

c

2

1

b

SQ

F=CF=C @#a.SQ((#.F=C.#P.N&F), T=N

SQ((#.F=C.#P.N&F), T=N#.F=C.#P.N&F #.F=C.#P.N&F

F=C.#P.N&FF=C.#P.N&FF = cF = b

#P.N&F#P.N&F

N&FN&F

T= NT = N

Terminal

b, c

Page 22: Wave Technology

Procedures as network nodes• Fprocedure = {

DIRECT # a. ANY # ANY. TERMINAL = CONTENT

}.CREATE ( DIRECT # Fprocedure ).DIRECT # b;c. CREATE ( f # PREDECESSOR )

Short: Fp = {@#a. #. T=C}. CR(@#Fp). @#b;c. CR(f#P)CR(@#{@#a. #. T=C}). @#b;c. CR(f#P)

Page 23: Wave Technology

Procedures as network nodes• CR(@#{@#a. #. T=C}). @#b;c. CR(f#P)• Activating the procedure:

DIRECT # c. f # ANY. ^CONTENTShort: @#c. f#. ^C

a

b c

@#a.#.T=C

@#c.f#.^C

f#. ^C^C

ff

@a.#.T=C

#.T=C #.T=C

T=CT=C

Teminal 1 Teminal 2

b c

Page 24: Wave Technology

Creating arbitrary networksCREATE (

DIRECT # b. Freturn = ADDESS.s # d.( r # a. P # Freturn),( t # c. q # Freturn )

)

CR(@#b. F=A.s#d. (r#a.p#F), (t#c.q#F))

a

b

c

p

s

q

tr

d

Page 25: Wave Technology

Creating arbitrary networksCR(@#b. F=A.s#d. (r#a.p#F), (t#c.q#F))

d

a

b

c

p

s

q

tr

CR(@#b. F=A.s#d. (r#a.p#F), (t#c.q#F))

CR(s#d. (r#a.p#F), (t#c.q#F))F = [b]

F = A

CR(r#a.p#F)F = [b]

CR(r#a.p#F)F = [b]

CR(p#F)F = [b]

CR(p#F)F = [b]

Page 26: Wave Technology

Following a path in a network• Following an explicit path in the networkDIRECT # a.P # ANY. q # ANY. S # ANY.TERMINAL = CONTENT

Short: @#a. p#. q#. s#. T =Cd

a

b

c

p

s

q

tr

@#a.p#.q#.s#.T=Cp#.q#.s#.T=C

q#.s#.T=C

s#.T=C

T=C

Terminal

Page 27: Wave Technology

27

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 28: Wave Technology

Session 3: The WAVE Language

Page 29: Wave Technology

Main knowledge network components

18Peter Mary

John

loves agea1a1

a1

a1

Node

Absolute node addresses

friends

Nonoriented links

Oriented links

Individual node & link names (contents)

Page 30: Wave Technology

Syntax• WAVE {{Move,}.}• Move Dat Op Dat | [Rule] (WAVE)• Rule SQ | OS | OP | AS | AP | RP | WT |

ID |CR | RL• Dat {string;} | N {L_D} | f {L_D} | C | A | P

| S | T• Op # | ## | ~ | /~ | == | /= | < | <= | > |

>= | ! | ^ | = | + | - | * | / | & | : | :: | | | % | ?

Page 31: Wave Technology

31

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 32: Wave Technology

Session 4: Rules

Page 33: Wave Technology

33

Rules

• Branching Rules• Repetition• Wait• Protecting Shared Resources• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 34: Wave Technology

34

Rules

• BRANCHING RULES• Repetition• Wait• Protecting Shared Resources• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 35: Wave Technology

Branching Rules

• SEQUENCE (SQ)• OR_SEQUENTIAL (OS)• AND_SEQUENTIAL (AS)• OR_PARALLEL (OP)• AND_PARALLEL (AP)• RANDOM (RD)

Page 36: Wave Technology

SEQUENCE (SQ)

SN R1

SN R2

SN R3

Startw1 w2 w3

Sequential: SQ( w1. w2. w3 )

Page 37: Wave Technology

SEQUENCE (SQ)F = 3. SQ ( F – 5, F + 2. T = F )

F = 3

SQ ( F – 5, F + 2. T = F )

SQ ( ( F – 5. T = F ), ( F + 2, T = F ) )

F – 5. T = F

F = 3 – 5 = -2 PRINT: -2F + 2. T = F

F = 3 + 2 = 5 PRINT: 5

Page 38: Wave Technology

SEQUENCE (SQ)F = 3. SQ ( F – 5, F + 2). T = F

F = 3

SQ ( F – 5, F + 2). T = F

SQ ( F – 5, F + 2 )

F – 5

F = 3 – 5 = -2

PRINT: -2

F + 2. T = F

F = 3 + 2 = 5

PRINT: 5

PRINT: 5

PRINT: -2

Page 39: Wave Technology

OR_SEQUENTIAL (OS)

SN R2

SN R4

Startw2 w4

OR_SEQUENTIAL(w1, w2, w3); w4

w1

w3

SN R3

Page 40: Wave Technology

OR_SEQUENTIAL (OS)

OR_SEQUENTIAL ( ( N == 1. p # b ), STAY ). N + 5

Page 41: Wave Technology

AND_SEQUENTIAL (AS)

Start

AND_SEQUENTIAL(w1, w2, w3)

w1

FALSE

Page 42: Wave Technology

AND_SEQUENTIAL (AS)N = { + #. Nn > 0 }; { #. T = C }

AND_SEQUENTIAL ( ^N )

Page 43: Wave Technology

OR_PARALLEL (OP)

SN R2

SN R4

Startw2 w4

OR_PARALLEL(w1, w2, w3); w4

w1

w3

SN R3

TRUE TRUE

Page 44: Wave Technology

OR_PARALLEL (OP)

Startw2

OR_PARALLEL(w1, w2, w3); w4

w1

w3

FALSE FALSE

FALSE

FALSE

Page 45: Wave Technology

AND_PARALLEL (OP)

SN R2

SN R4

Startw2 w4

AND_PARALLEL(w1, w2, w3); w4

w1

w3

SN R3

FALSE

Page 46: Wave Technology

AND_PARALLEL (AP)

SN R2

SN R4Start

w2 w4

AND_PARALLEL(w1, w2, w3); w4

w1

w3

SN R3 TRUE

TRUE

SN R1

TRUE

TRUE

SN R4

SN R4

w4

w4

Page 47: Wave Technology

AND_PARALLEL (AP)

AND_PARALLEL ( ANY # ANY. Ntest == None ). ^Ftail

Page 48: Wave Technology

RANDOM (RN)RN ( @ #. N12 + 100 )

Page 49: Wave Technology

49

Rules

• Branching Rules• REPETITION• Wait• Protecting Shared Resources• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 50: Wave Technology

RepetitionREPEAT ( + ANY # ANY ). TERMINAL = CONTENT

N = 2. REPEAT ( N /= 5 )

Page 51: Wave Technology

51

Rules

• Branching Rules• Repetition• WAIT• Protecting Shared Resources• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 52: Wave Technology

Wait

WAIT ( DIRECT # ANY. NN = 1. F = 2 ). wave_re

Page 53: Wave Technology

53

Rules

• Branching Rules• Repetition• Wait• PROTECTING SHARED RESOURCES• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 54: Wave Technology

54

Rules

• Branching Rules• Repetition• Wait• Protecting Shared Resources• CREATE• Release• Synchronized Versus Nonsynchronized Rules

Page 55: Wave Technology

55

Rules

• Branching Rules• Repetition• Wait• Protecting Shared Resources• Create• RELEASE• Synchronized Versus Nonsynchronized Rules

Page 56: Wave Technology

56

Rules

• Branching Rules• Repetition• Wait• Protecting Shared Resources• Create• Release• Synchronized Versus Nonsynchronized Rules

Page 57: Wave Technology

RulesSummary:• Rules are important in WAVE• Branching Rules: SQ, OS, AS, OP, AP, RN• Repetition, Wait, Protecting Shared

Resources (INDIVISIBLE), Create, Release are usually used in WAVE and Synchronized Versus Nonsynchonized help us more understand about rules.

Page 58: Wave Technology

58

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 59: Wave Technology

Session 5: Basic Space Navigation Mechanisms in WAVE

Page 60: Wave Technology

Breath-First Parallel Spread

• Start in some node as a current node• Repeat from all current nodes:

– If the current node is not marked, mark it• Otherwise, halt this branch

– Hop through all links (broadcast) to neighboring nodes (excluding the predecessor node from which the current node has been reached)

– Every node reached becomes a current node

Page 61: Wave Technology

Exemplary network topology

c

b

a t

e

g

c

b

d

a t

e

gr

p q

t

s

s

u

q

p

Page 62: Wave Technology

Repetitive SpreadDIRECT # c.REPEAT (

INDIVISIBLE (Node_mark == NONE. Node_mark =1).TERMINAL = CONTENT.ANY ## ANY

) c

bd

a t

e

g

rt s

qp

q

Page 63: Wave Technology

Recursive SpreadFbreadth_spread = { INDIVISIBLE ( Node_mark==NONE. Node_mark =

1) .TERMINAL = CONTENT .ANY # ANY .^ Fbreadth_spread}.DIRECT # c.^ Fbreadth_spread

Page 64: Wave Technology

Limited Depth SpreadDIRECT # a . Fdepth_limit = 2 .REPEAT (

Fcurrent_depth + 1 .Fcurrent_depth <= Fdepth_limit .INDIVISIBLE ( Node_mark == NONE. Node_mark

= 1) .TERMINAL = CONTENT .ANY # ANY

)

c

e

t s

d d

q

Page 65: Wave Technology

Spread Through All LinksDIRECT # c.REPEAT (

OR_SEQUENTIAL (INDIVISIBLE (

Node_mark == NONE. Node_mark = 1 .TERMINAL = LINK) ,( PREDECESSOR > ADDRESS . TERMINAL = LINK. DONE !)

) .ANY ## ANY

)

Page 66: Wave Technology

Evolent Spread

o Start in some node as a current nodeo Repeat from all current nodes:

– If the current node is not in the mobile list–Append the node's name to the mobile list

• Otherwise, halt this branch– Broadcast to all neighboring nodes (excluding

the predecessor node)– Every node reached becomes a current node

Page 67: Wave Technology

Repeatitive spread

DIRECT # c .REPEAT (

CONTENT /~ Fpassed_nodes .Fpassed_nodes & CONTENT .TERMINAL = CONTENT .ANY ## ANY

)

Page 68: Wave Technology

Evolvent tree

c

d b e

b a d a g t

a b a d f g

t sq

s r s p p q

p p r ru u

Page 69: Wave Technology

Parallel Breadth First Synchronous Spread

• Start in some node as a current node• Repeat from all current nodes

– Wait for full completion of the following processes• If the current node is not marked, mark it

–Otherwise, halt this branch• Hop through all links (broadcast) to

neighboring nodes (excluding the predecessor node)

• Every node reached become a current node

Page 70: Wave Technology

Using Nested Rules

Fnext = { TERMINAL = CONTENT . ANY ## ANY . INDIVISIBLE ( Node_mark == NONE. Node_mark = 1 )} .DIRECT # c. Node_mark = 1 .WAIT (

...WAIT ( ^Fnext). ^Fnext...

). ^Fnext). ^Fnext

Page 71: Wave Technology

Breadth-first synchronous spread

Step 1

Step2

c

d b e

a g t

t q s

p p q

Page 72: Wave Technology

Sequential breadth-first, or spiral, spread

spiral

c

d b e

a g f

t q s

p p q

Page 73: Wave Technology

Depth-First Sequential Spread

• Define the depth-first spread procedure as:– If current node is not marked, mark it, otherwise halt– Do the following sequentially for all links in the current node:

• Hop through a new link to a new current node• Activate the depth-first spread procedure

– Start in node c– Activate the depth-first spread procedure

Page 74: Wave Technology

Fdepth_first_spread ={ INDIVISIBLE ( Node_mark == NONE.

Node_mark = 1 ) . TERMINAL = CONTENT . SEQUENCE (ANY # ANY. ^Fdepth_first_spread

)} .DIRECT # c. ^Fdepth_first_spread

Page 75: Wave Technology

c

d e

a

b

g

t

SQ

SQ

SQ

SQ

SQ

SQ

SQ

t

r

p

s q

q s

pu

q

qs

Fig. 4.8. Depth-first sequential spread

Page 76: Wave Technology

CONTINUOUS SPREAD

LOOPING MODE• Start in some node and set up a marking color• Repeat from the starting node• Do the two steps sequentially from the starting node, which is

also a current node:1. Repeat from all current nodes

If the current node is not marked with the color, mark it with the colorHop through all links (broadcast) to neighboring nodes (excluding the predecessor node)Every node reached becomes a current node

2. Make a delay in the starting node and change the color

Page 77: Wave Technology

c

d e

a g t

t …

r …n ... … q

q… s

b

Continuous spread

Page 78: Wave Technology

Pipeline Mode

• Define the pipeline spread procedure as:– Set up a new, stronger, spread color– Do the following two parts independently and in parallel

1. Repeat from the current node– If the current node’s mark is weaker than the spead color, mark the

current node with the spread color, otherwise halt– Broadcast though all links to neighboring nodes (except the

predecessor node), each becoming current node

2. Activate the pipeline spread procedure after a delay– Start in node c as a current node– Activate the pipeline spread procedure

Page 79: Wave Technology

79

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 80: Wave Technology

Session 6: Graphical representation of wave: SPREAD DIAGRAMS

Page 81: Wave Technology

Spread diagram

1. Basic Components:

SNR m Arbitrary move

AS

…Rules and

rule –controller

moves

1.1 Halts

Link Ni Fj Spatial variable

Page 82: Wave Technology

Spread diagram

2. Structuring:m1.m2,(m3.m4).m5

m1

m2 m3

m4

m1.(m2,(m3.m4)).m5

SNR1

SNR3

SNR2

m5

m1

SNR1m234

m2 m3

m4

SNR1*

SNR3*

SNR2*

SNR3m5

Page 83: Wave Technology

Spread diagram

3. More details:

F=N1

a#

N2=F

SNR0 N1

F

N1

F

N2

F

m1

SNR1

m2

SNR2

m3

F=N1.a#.N2=F(a)

m1

m2

SNR1

SNR2

m1..m2

(c)

m1

m2

m3

SNR1

SNR2

m1.m2,.m3

(d)

F>0

F=1

m4

SNR1

F

F

m2

SNR2

m3

SNR3

F=1.F>0.F!.=m4(b)

F!

m1

F

Page 84: Wave Technology

Spread diagram

4. Parallel processes in Distributed data:

m1 m3m2

SNR1

SNR3

SNR2

m4 m5

m1, m2,m3. m4, m5

m1 m3m2

SNR1

SNR3

(m1.m4, m5),(m2.m4,m5) , (m3.m4,m5)

m5 m4 m5 m4 m5m4

SNR21 SNR22 SNR23

Page 85: Wave Technology

m1

m2

m3

SNR0

SNR1

SNR2

SNR3

m1.m2.m3

m1

m2 m2 m2

m3SNR2

SNR3

m1.m2, m2,m2.m3

m1

m2 m2 m2

SNR3m1.(m2(m3,m3,m3)), (m2.(m3,m3,m3)), (m2.(m3,m3,m3))

m3 m3 m3 m3 m3 m3 m3 m3 m3

Page 86: Wave Technology

m1

OP

m1.OP(m2,m3.m4).m5

m2 m3

m4SNR2

SNR3

SNR4

SNR1

m5

m1

OP

m1.OP((m2.m4),(m3.m4)).m5

m2

m4

SNR21

SNR31

SNR4m5

m3

m4

SNR22

SNR32branch1 branch2

OP

m1

m4

m2

m4 m4

SNR31

m3

m4 m4 m4

SNR32

SNR4

m5

m1.OP((m2.m4,m4,m4), (m3.m4,m4,m4)).m5

Page 87: Wave Technology

Spread diagram

5. Example:

Knowledge Network

a

bc

p q

a a a …

b b b… c c c …

ENTRY

AS

AS

@#a

p#b q#c

m1

T=C.5?sleepm2

SNR1

CREATE(DIRECT#a.p#b,q#c,STAY).REPEAT(TERMINAL=CONTENT.5?sleep)

Page 88: Wave Technology

88

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 89: Wave Technology

Session 7: Wave and sequential programming

Page 90: Wave Technology

90

Wave and sequential programming

• Expressing a sequence of Statements• If-else Statements• Multiway Decisions• Loops

Page 91: Wave Technology

91

Wave and sequential programming

• EXPRESSING A SEQUENCE OF STATEMENTS• If-else Statements• Multiway Decisions• Loops

Page 92: Wave Technology

92

Expressing a sequence of Statements

• C languages1 ; s2 ; s3 ; s4

• Wave– Depth mode: period operator

s1 . s2 . s3 . s4– Breadth mode: using SQ rule with comma

seperatorSQ(s1, s2, s3, s4)

– Combination of the two

Page 93: Wave Technology

93

Expressing a sequence of Statements (2)

s1

s2

s3

s4s1 s2 s3 s4

SQ

s1.s2.s3.s4SQ(s1,s2,s3,s4)

Page 94: Wave Technology

94

Expressing a sequence of Statements (3)

s1

s2

s3

s4

SQ s1 s2

s3 s4

SQ

SQ

s1.SQ((s2.s3),s4) SQ(s1,(s2.SQ(s3,s4)))

Page 95: Wave Technology

95

Expressing a sequence of Statements (4)

s1 s2

s3

s4

SQ

1!s12 s1 s2 s3

s4

SQ

RN

(SQ(s1,(s2. 1!)).s3.s4)RN(SQ(s1, s2, s3)).s4

Page 96: Wave Technology

96

Wave and sequential programming

• Expressing a sequence of Statements• IF-ELSE STATEMENTS• Multiway Decisions• Loops

Page 97: Wave Technology

97

If-else Statements

e

s1

s2

OS

e

s2

s1

AS

OS

1!

OS(e . s1,s2 )OS(AS(e . 1! , s1),s2)

Page 98: Wave Technology

98

If-else Statements (2)

e

s1

OSe

s1

WT

1!

e s1

SQ

1!

AS

SQ(AS(e , s1 . 1!), )WT(e . s1 . 1! , )OS(e . s1 , )

Page 99: Wave Technology

99

Wave and sequential programming

• Expressing a sequence of Statements• If-else Statements• MULTIWAY DECISIONS• Loops

Page 100: Wave Technology

100

Multiway Decisions

• else-if with filters

OS((e1 . s1) , (e2 . s2) , … , (em . sm) , sd )

e1 em

s1

OS

sm sd

……

Page 101: Wave Technology

101

Multiway Decisions (2)

• Else-if parallel version

e1 em

S1

OS

sm sd

……

RN

RN(OS(((e1 . s1) , (e2 . s2) , … , (em . sm)) , sd ))

Page 102: Wave Technology

102

Multiway Decisions (3)

• Else-if with AS rule

RN(OS(AS(e1 , s1) , … , AS(em , sm) , sd))

e1 sms1

RN

em

sd

OS

ASAS

……

Page 103: Wave Technology

103

Multiway Decisions (4)

• switch

N==c1 N==cm

s1

OS

sm sd

e

e . OS((N==c1 , s1) , … , (N==cm , sm) , sd)

Page 104: Wave Technology

104

Wave and sequential programming

• Expressing a sequence of Statements• If-else Statements• Multiway Decisions• LOOPS

Page 105: Wave Technology

105

Loops

• Most traditional types– while ( e ) s– do s while ( e )

• ‘For’ Statement– For (e1 ; e2 ; e3) s e1; while (e2) { s; e3 }

Repetition Expressing loops by Recursion

Page 106: Wave Technology

106

Loops (2)

• Express using Repetition

p

RP

q

RP(p.q)

p

RP

q

AS

1!

RP(AS(p, (q . 1!))

p

RP

q

RN

AS

RP(RN(AS(p , q)))

Page 107: Wave Technology

107

Loops (3)

• Express using Recursion

q

^Nl

p

{ }Nl=

SQ

^Nl

Nl = {p . q . ^Nl} . SQ(^Nl , )

q

^Nl

p{ }Nl=

SQ

^Nl

AS

Nl = {AS(p , (q . ^Nl))} . SQ(^Nl , )

q

^Nl

p

{ }Nl=

^Nl

Nl = {p . q . ^Nl} .^ Nl

Page 108: Wave Technology

108

Loops (4)

‘For’ statement examples• C style: for (i = 0; i < n; i++) s += a[i]

• Ni = 1 . REPEAT (Ni <= Nn . Ns + Na : Ni . Ni + 1)• REPEAT ( Ni < Nn . Ni + 1 . Ns + Na : Ni)• Sequential programming in Wave: Nodal and

Frontal variables are the same!

Page 109: Wave Technology

109

Table of Contents

A. IntroductionB. Getting Started with WAVE ProgrammingC. The WAVE LanguageD. RulesE. Basic Space Navigation Mechanisms in WAVEF. Graphical representation of wave: SPREAD

DIAGRAMSG. Wave and sequential programmingH. Modeling inter-process communications

Page 110: Wave Technology

Session 8: Modeling inter-process communications

Page 111: Wave Technology

Modeling inter process communication

• Asynchronous data transfer• One-way synchronization• Bilateral rendezvous (two-way)• Sharing common resources

Page 112: Wave Technology

Modeling inter process communication

1. Asynchronous data transfer• Sender:head producing Nsender( Ftransit = Nsender.link # receiver.Nreceiver = Ftransit

)tail

• Receiver: any process using Nreceiver

Page 113: Wave Technology

Modeling inter process communication

1. Asynchronous data transfer

head

head.(Ft=Ns.l#r.Nr=Ft),tail

tail

Ft = Ns.l#r

Nr

Nr = Ft

any process using Nr

process

Ns

Page 114: Wave Technology

Modeling inter process communication

2. One-way synchronization• Sender:head producing Nsender( Ftransit = Nsender.

link # receiver.Nreceiver = Ftransit)tail

• Receiver: HeadREPEAT( Nreceiver == NONE).Tail consuming Nreceiver

Page 115: Wave Technology

Modeling inter process communication

2. One-way synchronization

head

tail

Ft = Ns.l#r

Nr

Nr = Ft

head

RP

tail

Nr ==

Ns Nr

Same location

head.(Ft=Ns.l#r.Nr=Ft),tail head.RP(Nr==).tail

Page 116: Wave Technology

Modeling inter process communication3. Bilateral rendezvous (two-way)• Sender:head producing NsenderREPEAT(Nbegin == NONE).( Ftransit = Nsender.link # receiver.Nreceiver = Ftransit

)tail• Receiver: Head(link # sender.Nbegin = 1),(REPEAT( Nreceiver == NONE).Tail consuming Nreceiver)

Page 117: Wave Technology

Modeling inter process communication3. Bilateral rendezvous (two-way)

head

tail

Ft = Ns.l#r

Nr

Nr = Ft

head

RP

tail

Nr ==Nr

Same location

RP

Nb ==

Ns

NbNs l#s

Nb

Nb = 1

Same location

head.RP(Nb==).(Ft=Ns.l#r.Nr=Ft),tail head.(l#s.Nb=1),RP(Nr==).tail

Page 118: Wave Technology

Modeling inter process communication3. Sharing common resouces(head_1.INDIVISIBLE( working_with_a_common_resouce).tail_1),(head_2.INDIVISIBLE( working_with_a_common_resouce).tail_2),……(head_m.INDIVISIBLE( working_with_a_common_resouce).tail_m)

Page 119: Wave Technology

Modeling inter process communication3. Sharing common resources

head 1

tail 1

ID

Working with a common resource

process 1

head m

tail m

ID

Working with a common resource

process m

Same location

Page 120: Wave Technology

120

THANKS FOR YOUR ATTENTION!