369
Motivation Formalizing Sequential Constructiveness (SC) Wrap-Up Synchronous Languages—Lecture 13 Prof. Dr. Reinhard von Hanxleden Christian-Albrechts Universit¨ at Kiel Department of Computer Science Real-Time Systems and Embedded Systems Group 22 June 2015 Last compiled: July 1, 2015, 11:57 hrs Sequentially Constructive Concurrency Synchronous Languages SS 2015, Lecture 13 Slide 1

rvh/ss15/v-synch/lectures/lecture13.pdf

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Languages—Lecture 13

Prof. Dr. Reinhard von Hanxleden

Christian-Albrechts Universitat KielDepartment of Computer Science

Real-Time Systems and Embedded Systems Group

22 June 2015Last compiled: July 1, 2015, 11:57 hrs

Sequentially ConstructiveConcurrency

Synchronous Languages SS 2015, Lecture 13 Slide 1

Page 2: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks? What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 3: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks? What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 4: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks? What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 5: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks?

What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 6: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks? What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 7: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The 5-Minute Review Session

1. How do SCCharts and SyncCharts differ?

2. What does the initialize-update-read protocol refer to?

3. What is the SCG?

4. What are basic blocks? What are scheduling blocks?

5. When compiling from the SCG, what types of low-levelsynthesis do we distinguish? How do they compare?

Synchronous Languages SS 2015, Lecture 13 Slide 2

Page 8: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Safety-Critical Embedded Systems

I Embedded systems oftensafety-critical

I Safety-critical systems mustreact deterministically

I Computations often exploitconcurrency

I Key challenge:Concurrency must bedeterministic!

Thanks to Michael Mendler (U Bamberg) for support with theseslides

Synchronous Languages SS 2015, Lecture 13 Slide 3

Page 9: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Safety-Critical Embedded Systems

I Embedded systems oftensafety-critical

I Safety-critical systems mustreact deterministically

I Computations often exploitconcurrency

I Key challenge:Concurrency must bedeterministic!

Thanks to Michael Mendler (U Bamberg) for support with theseslides

Synchronous Languages SS 2015, Lecture 13 Slide 3

Page 10: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Safety-Critical Embedded Systems

I Embedded systems oftensafety-critical

I Safety-critical systems mustreact deterministically

I Computations often exploitconcurrency

I Key challenge:Concurrency must bedeterministic!

Thanks to Michael Mendler (U Bamberg) for support with theseslides

Synchronous Languages SS 2015, Lecture 13 Slide 3

Page 11: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Safety-Critical Embedded Systems

I Embedded systems oftensafety-critical

I Safety-critical systems mustreact deterministically

I Computations often exploitconcurrency

I Key challenge:Concurrency must bedeterministic!

Thanks to Michael Mendler (U Bamberg) for support with theseslides

Synchronous Languages SS 2015, Lecture 13 Slide 3

Page 12: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:

, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 13: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar

, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 14: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm

/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 15: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 16: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming

:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 17: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction

=⇒ Constructiveness/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 18: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 19: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers

/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 20: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 21: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing (Deterministic) Concurrency

I C, Java, etc.:, Familiar, Expressive sequential paradigm/ Concurrent threads unpredictable in functionality and timing

I Synchronous Programming:

, predictable by construction=⇒ Constructiveness

/ Unfamiliar to most programmers/ Restrictive in practice

Aim: Deterministic concurrency with synchronous foundations,but without synchronous restrictions.

Synchronous Languages SS 2015, Lecture 13 Slide 4

Page 22: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...

I Asynchronous schedule

o

By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperative

o

All sequential control flowprescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic schedule

o

By default: Single writer percycle, all reads initialized

o On demand: Separatemultiple assignments byclock barrier (pause, wait)

I Declarative

o

All micro-steps sequentialcontrol flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 23: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o

By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperative

o

All sequential control flowprescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic schedule

o

By default: Single writer percycle, all reads initialized

o On demand: Separatemultiple assignments byclock barrier (pause, wait)

I Declarative

o

All micro-steps sequentialcontrol flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 24: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperative

o

All sequential control flowprescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic scheduleo By default: Single writer per

cycle, all reads initialized

o On demand: Separatemultiple assignments byclock barrier (pause, wait)

I Declarative

o

All micro-steps sequentialcontrol flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 25: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperative

o

All sequential control flowprescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic scheduleo By default: Single writer per

cycle, all reads initializedo On demand: Separate

multiple assignments byclock barrier (pause, wait)

I Declarative

o

All micro-steps sequentialcontrol flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 26: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperative

o

All sequential control flowprescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic scheduleo By default: Single writer per

cycle, all reads initializedo On demand: Separate

multiple assignments byclock barrier (pause, wait)

I Declarative

o

All micro-steps sequentialcontrol flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 27: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperativeo All sequential control flow

prescriptive

o Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic scheduleo By default: Single writer per

cycle, all reads initializedo On demand: Separate

multiple assignments byclock barrier (pause, wait)

I Declarativeo All micro-steps sequential

control flow descriptive

o Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 28: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds

Sequential Languages

I C, Java, ...I Asynchronous schedule

o By default: Multipleconcurrent readers/writers

o On demand: Singleassignment synchronization(locks, semaphores)

I Imperativeo All sequential control flow

prescriptiveo Resolved by programmer

Synchronous Languages

I Esterel, Lustre, Signal,SCADE, SyncCharts ...

I Clocked, cyclic scheduleo By default: Single writer per

cycle, all reads initializedo On demand: Separate

multiple assignments byclock barrier (pause, wait)

I Declarativeo All micro-steps sequential

control flow descriptiveo Resolved by scheduler

Synchronous Languages SS 2015, Lecture 13 Slide 5

Page 29: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds (Cont’d)

Sequential LanguagesI Asynchronous schedule

/

No guarantees of determinismor deadlock freedom

, Intuitive programmingparadigm

Synchronous LanguagesI Clocked, cyclic schedule

,

Deterministic concurrencyand deadlock freedom

/ Heavy restrictions byconstructiveness analysis

=⇒Sequentially Constructive Model of Computation (SC MoC), Deterministic concurrency and deadlock freedom

, Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 6

Page 30: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds (Cont’d)

Sequential LanguagesI Asynchronous schedule

/ No guarantees of determinismor deadlock freedom

, Intuitive programmingparadigm

Synchronous LanguagesI Clocked, cyclic schedule

, Deterministic concurrencyand deadlock freedom

/ Heavy restrictions byconstructiveness analysis

=⇒Sequentially Constructive Model of Computation (SC MoC), Deterministic concurrency and deadlock freedom

, Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 6

Page 31: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds (Cont’d)

Sequential LanguagesI Asynchronous schedule

/ No guarantees of determinismor deadlock freedom

, Intuitive programmingparadigm

Synchronous LanguagesI Clocked, cyclic schedule

, Deterministic concurrencyand deadlock freedom

/ Heavy restrictions byconstructiveness analysis

=⇒Sequentially Constructive Model of Computation (SC MoC), Deterministic concurrency and deadlock freedom

, Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 6

Page 32: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Comparing Both Worlds (Cont’d)

Sequential LanguagesI Asynchronous schedule

/ No guarantees of determinismor deadlock freedom

, Intuitive programmingparadigm

Synchronous LanguagesI Clocked, cyclic schedule

, Deterministic concurrencyand deadlock freedom

/ Heavy restrictions byconstructiveness analysis

=⇒Sequentially Constructive Model of Computation (SC MoC), Deterministic concurrency and deadlock freedom

, Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 6

Page 33: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow

:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 34: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive

, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 35: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler

, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 36: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 37: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow

:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 38: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive

, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 39: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer

, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 40: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Implementing Deterministic Concurrency: SC MoC

I Concurrent micro-step control flow:

, Descriptive, Resolved by scheduler, =⇒ Deterministic concurrency and deadlock freedom

I Sequential micro-step control flow:

, Prescriptive, Resolved by the programmer, =⇒ Intuitive programming paradigm

Synchronous Languages SS 2015, Lecture 13 Slide 7

Page 41: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program

Synchronous Languages SS 2015, Lecture 13 Slide 8

Page 42: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Synchronous Languages SS 2015, Lecture 13 Slide 9

Page 43: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Synchronous Languages SS 2015, Lecture 13 Slide 10

Page 44: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Imperative program order (sequential access to shared variables)

I “write-after-write” can change value sequentially

I Prescribed by programmer

, Accepted in SC MoC/ Not permitted in standard synchronous MoC

Synchronous Languages SS 2015, Lecture 13 Slide 11

Page 45: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Imperative program order (sequential access to shared variables)I “write-after-write” can change value sequentially

I Prescribed by programmer

, Accepted in SC MoC/ Not permitted in standard synchronous MoC

Synchronous Languages SS 2015, Lecture 13 Slide 11

Page 46: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Imperative program order (sequential access to shared variables)I “write-after-write” can change value sequentially

I Prescribed by programmer

, Accepted in SC MoC/ Not permitted in standard synchronous MoC

Synchronous Languages SS 2015, Lecture 13 Slide 11

Page 47: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Imperative program order (sequential access to shared variables)I “write-after-write” can change value sequentially

I Prescribed by programmer

, Accepted in SC MoC/ Not permitted in standard synchronous MoC

Synchronous Languages SS 2015, Lecture 13 Slide 11

Page 48: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Concurrency scheduling constraints (access to shared variables):

I “write-before-read” for concurrent write/readsI “write-before-write” (i. e., conflicts!) for concurrent & non-confluent

writesI Micro-tick thread scheduling prohibits race conditionsI Implemented by the SC compiler

Synchronous Languages SS 2015, Lecture 13 Slide 12

Page 49: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Concurrency scheduling constraints (access to shared variables):I “write-before-read” for concurrent write/reads

I “write-before-write” (i. e., conflicts!) for concurrent & non-confluentwrites

I Micro-tick thread scheduling prohibits race conditionsI Implemented by the SC compiler

Synchronous Languages SS 2015, Lecture 13 Slide 12

Page 50: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Concurrency scheduling constraints (access to shared variables):I “write-before-read” for concurrent write/readsI “write-before-write” (i. e., conflicts!) for concurrent & non-confluent

writes

I Micro-tick thread scheduling prohibits race conditionsI Implemented by the SC compiler

Synchronous Languages SS 2015, Lecture 13 Slide 12

Page 51: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Concurrency scheduling constraints (access to shared variables):I “write-before-read” for concurrent write/readsI “write-before-write” (i. e., conflicts!) for concurrent & non-confluent

writesI Micro-tick thread scheduling prohibits race conditions

I Implemented by the SC compiler

Synchronous Languages SS 2015, Lecture 13 Slide 12

Page 52: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

A Sequentially Constructive Program (Cont’d)

Concurrency scheduling constraints (access to shared variables):I “write-before-read” for concurrent write/readsI “write-before-write” (i. e., conflicts!) for concurrent & non-confluent

writesI Micro-tick thread scheduling prohibits race conditionsI Implemented by the SC compiler

Synchronous Languages SS 2015, Lecture 13 Slide 12

Page 53: rvh/ss15/v-synch/lectures/lecture13.pdf

A Constructive Game of Schedulability

logically reactive program ProgrammerI Defines the rules

I Prescribes sequential execution order

I Leaves concurrency to compiler and run-time

I “Free Schedules”

Compiler = PlayerI Determines winning strategy

I Restricts concurrency to ensure determinacyand deadlock freedom

I “Admissible Schedules”

Run-time = OpponentI Tries to choose a spoiling execution from

admissible schedules

Page 54: rvh/ss15/v-synch/lectures/lecture13.pdf

A Constructive Game of Schedulability

logically reactive program ProgrammerI Defines the rules

I Prescribes sequential execution order

I Leaves concurrency to compiler and run-time

I “Free Schedules”

Compiler = PlayerI Determines winning strategy

I Restricts concurrency to ensure determinacyand deadlock freedom

I “Admissible Schedules”

Run-time = OpponentI Tries to choose a spoiling execution from

admissible schedules

Page 55: rvh/ss15/v-synch/lectures/lecture13.pdf

A Constructive Game of Schedulability

logically reactive program ProgrammerI Defines the rules

I Prescribes sequential execution order

I Leaves concurrency to compiler and run-time

I “Free Schedules”

Compiler = PlayerI Determines winning strategy

I Restricts concurrency to ensure determinacyand deadlock freedom

I “Admissible Schedules”

Run-time = OpponentI Tries to choose a spoiling execution from

admissible schedules

Page 56: rvh/ss15/v-synch/lectures/lecture13.pdf

A Constructive Game of Schedulability

logically reactive program ProgrammerI Defines the rules

I Prescribes sequential execution order

I Leaves concurrency to compiler and run-time

I “Free Schedules”

Compiler = PlayerI Determines winning strategy

I Restricts concurrency to ensure determinacyand deadlock freedom

I “Admissible Schedules”

Run-time = OpponentI Tries to choose a spoiling execution from

admissible schedules

Page 57: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 58: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accesses

I Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 59: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmer

I Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 60: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platform

I Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 61: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 62: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variable

I Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 63: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data races

I Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 64: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compiler

I Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 65: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 66: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Sequential Admissibility – Basic Idea

I Sequentially ordered variable accessesI Are enforced by the programmerI Cannot be reordered by compiler or run-time platformI Exhibit no races

I Only concurrent writes/reads to the same variableI Generate potential data racesI Must be resolved by the compilerI Can be ordered under multi-threading and run-time

The following applies to concurrent variable accesses only ...

Synchronous Languages SS 2015, Lecture 13 Slide 14

Page 67: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 68: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 69: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 70: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 71: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 72: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 73: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 74: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 75: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 76: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Organizing Concurrent Variable Accesses

SC Concurrent Memory Access Protocol (per macro tick)

Confluent Statements (per macro tick)

Synchronous Languages SS 2015, Lecture 13 Slide 15

Page 77: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple

– but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 78: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 79: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 80: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 81: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 82: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 83: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

C, Java vs. Synchronous ProgrammingThe Control ExampleA Constructive Game of Schedulability

Goals and ChallengesThe idea behind SC is simple – but getting it “right” not so!

What we are up to:

1. Want to be conservative wrt “Berry constructiveness”I An Esterel program should also be SC

2. Want maximal freedom without compromising determinacyI A determinate program should also be SCI An SC program must be determinate

3. Want to exploit sequentiality as much as possibleI But what exactly is sequentiality?

4. Want to define not only the exact concept of SC, but also apractical strategy to implement it

I In practice, this requires conservative approximationsI Compiler must not accept Non-SC programsI Compiler may reject SC programs

Synchronous Languages SS 2015, Lecture 13 Slide 16

Page 84: rvh/ss15/v-synch/lectures/lecture13.pdf

References

Most of the material here draws from this reference [TECS]:

R. von Hanxleden, M. Mendler, J. Aguado, B. Duderstadt, I. Fuhrmann, C.Motika, S. Mercer, O. O’Brien, and P. Roop.Sequentially Constructive Concurrency – A Conservative Extension of theSynchronous Model of Computation.ACM Transactions on Embedded Computing Systems, Special Issue onApplications of Concurrency to System Design, July 2014, 13(4s).http://rtsys.informatik.uni-kiel.de/˜biblio/downloads/papers/tecs14.pdf

Unless otherwise noted, the numberings of definitions, sections etc.refer to this.

There is also an extended version [TR]:

R. von Hanxleden, M. Mendler, J. Aguado, B. Duderstadt, I. Fuhrmann, C.Motika, S. Mercer, O. O’Brien, and P. Roop.Sequentially Constructive Concurrency – A Conservative Extension of theSynchronous Model of Computation.Christian-Albrechts-Universitat zu Kiel, Department of Computer Science,Technical Report 1308, ISSN 2192-6247, Aug. 2013, 13(4s).http://rtsys.informatik.uni-kiel.de/˜biblio/downloads/papers/report-1308.pdf

Page 85: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Overview

Motivation

Formalizing Sequential Constructiveness (SC)The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Wrap-Up

Synchronous Languages SS 2015, Lecture 13 Slide 18

Page 86: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Sequentially Constructive Language (SCL) [Sec. 2.1]

I Foundation for the SC MoC

I Minimal Language

I Adopted from C/Java and Esterel

s ::= x = e | s;s | if (e) s else s | l : s | goto l |fork s par s join | pause

s Statement

x Variable

e Expression

l Program label

Synchronous Languages SS 2015, Lecture 13 Slide 19

Page 87: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Sequentially Constructive Language (SCL) [Sec. 2.1]

I Foundation for the SC MoC

I Minimal Language

I Adopted from C/Java and Esterel

s ::= x = e | s;s | if (e) s else s | l : s | goto l |fork s par s join | pause

s Statement

x Variable

e Expression

l Program label

Synchronous Languages SS 2015, Lecture 13 Slide 19

Page 88: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Sequentially Constructive Language (SCL) [Sec. 2.1]

I Foundation for the SC MoC

I Minimal Language

I Adopted from C/Java and Esterel

s ::= x = e | s;s | if (e) s else s | l : s | goto l |fork s par s join | pause

s Statement

x Variable

e Expression

l Program label

Synchronous Languages SS 2015, Lecture 13 Slide 19

Page 89: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Sequentially Constructive Language (SCL) [Sec. 2.1]

I Foundation for the SC MoC

I Minimal Language

I Adopted from C/Java and Esterel

s ::= x = e | s;s | if (e) s else s | l : s | goto l |fork s par s join | pause

s Statement

x Variable

e Expression

l Program label

Synchronous Languages SS 2015, Lecture 13 Slide 19

Page 90: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The SC Graph (SCG) [Sec. 2.3]

The concurrent and sequentialcontrol flow of an SCL program isgiven by an SC Graph (SCG)

Internal representation for

I Semantic foundationI AnalysisI Code generation

SC Graph:Labeled graph G = (N,E )I Nodes N correspond to statements of

sequential programI Edges E reflect sequential execution

control flow

Synchronous Languages SS 2015, Lecture 13 Slide 20

Page 91: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The SC Graph (SCG) [Sec. 2.3]

The concurrent and sequentialcontrol flow of an SCL program isgiven by an SC Graph (SCG)

Internal representation for

I Semantic foundationI AnalysisI Code generation

SC Graph:Labeled graph G = (N,E )I Nodes N correspond to statements of

sequential programI Edges E reflect sequential execution

control flow

Synchronous Languages SS 2015, Lecture 13 Slide 20

Page 92: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The SC Graph (SCG) [Sec. 2.3]

The concurrent and sequentialcontrol flow of an SCL program isgiven by an SC Graph (SCG)

Internal representation for

I Semantic foundationI AnalysisI Code generation

SC Graph:Labeled graph G = (N,E )I Nodes N correspond to statements of

sequential programI Edges E reflect sequential execution

control flow

Synchronous Languages SS 2015, Lecture 13 Slide 20

Page 93: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Node Types in the SCG

Node n ∈ N has statement type n.st

I n.st ∈{entry, exit, goto, x = ex , if (ex), fork, join, surf, depth}

I x : variable, ex : expression.

Synchronous Languages SS 2015, Lecture 13 Slide 21

Page 94: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Node Types in the SCG

Node n ∈ N has statement type n.st

I n.st ∈{entry, exit, goto, x = ex , if (ex), fork, join, surf, depth}

I x : variable, ex : expression.

Synchronous Languages SS 2015, Lecture 13 Slide 21

Page 95: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Define edge types:

I iur-edges αiur =def {ww , iu, ur , iu}I instantaneous edges αins =def {seq} ∪ αiur

I arbitrary edges αa =def {tick} ∪ αins

I flow edges αflow =def {seq, tick}

Synchronous Languages SS 2015, Lecture 13 Slide 22

Page 96: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Define edge types:

I iur-edges αiur =def {ww , iu, ur , iu}

I instantaneous edges αins =def {seq} ∪ αiur

I arbitrary edges αa =def {tick} ∪ αins

I flow edges αflow =def {seq, tick}

Synchronous Languages SS 2015, Lecture 13 Slide 22

Page 97: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Define edge types:

I iur-edges αiur =def {ww , iu, ur , iu}I instantaneous edges αins =def {seq} ∪ αiur

I arbitrary edges αa =def {tick} ∪ αins

I flow edges αflow =def {seq, tick}

Synchronous Languages SS 2015, Lecture 13 Slide 22

Page 98: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Define edge types:

I iur-edges αiur =def {ww , iu, ur , iu}I instantaneous edges αins =def {seq} ∪ αiur

I arbitrary edges αa =def {tick} ∪ αins

I flow edges αflow =def {seq, tick}

Synchronous Languages SS 2015, Lecture 13 Slide 22

Page 99: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Define edge types:

I iur-edges αiur =def {ww , iu, ur , iu}I instantaneous edges αins =def {seq} ∪ αiur

I arbitrary edges αa =def {tick} ∪ αins

I flow edges αflow =def {seq, tick}

Synchronous Languages SS 2015, Lecture 13 Slide 22

Page 100: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Edge e ∈ E has edge type e.type ∈ αa

I Specifies the nature of the particular ordering constraintexpressed by e

I For e.type = α, write e.src →α e.tgt, pronounced “e.srcα-precedes e.tgt”

I n1 →seq n2: sequential successors

I n1 →tick n2: tick successors

I n1 →seq n2, n1 →tick n2: flow successors,induced directly from source program

I �seq: reflexive and transitive closure of →seq

I Note: n1 →seq n2 does not imply fixed run-time orderingbetween n1 and n2 (consider loops)

Synchronous Languages SS 2015, Lecture 13 Slide 23

Page 101: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Edge e ∈ E has edge type e.type ∈ αa

I Specifies the nature of the particular ordering constraintexpressed by e

I For e.type = α, write e.src →α e.tgt, pronounced “e.srcα-precedes e.tgt”

I n1 →seq n2: sequential successors

I n1 →tick n2: tick successors

I n1 →seq n2, n1 →tick n2: flow successors,induced directly from source program

I �seq: reflexive and transitive closure of →seq

I Note: n1 →seq n2 does not imply fixed run-time orderingbetween n1 and n2 (consider loops)

Synchronous Languages SS 2015, Lecture 13 Slide 23

Page 102: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Edge e ∈ E has edge type e.type ∈ αa

I Specifies the nature of the particular ordering constraintexpressed by e

I For e.type = α, write e.src →α e.tgt, pronounced “e.srcα-precedes e.tgt”

I n1 →seq n2: sequential successors

I n1 →tick n2: tick successors

I n1 →seq n2, n1 →tick n2: flow successors,induced directly from source program

I �seq: reflexive and transitive closure of →seq

I Note: n1 →seq n2 does not imply fixed run-time orderingbetween n1 and n2 (consider loops)

Synchronous Languages SS 2015, Lecture 13 Slide 23

Page 103: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Edge e ∈ E has edge type e.type ∈ αa

I Specifies the nature of the particular ordering constraintexpressed by e

I For e.type = α, write e.src →α e.tgt, pronounced “e.srcα-precedes e.tgt”

I n1 →seq n2: sequential successors

I n1 →tick n2: tick successors

I n1 →seq n2, n1 →tick n2: flow successors,induced directly from source program

I �seq: reflexive and transitive closure of →seq

I Note: n1 →seq n2 does not imply fixed run-time orderingbetween n1 and n2

(consider loops)

Synchronous Languages SS 2015, Lecture 13 Slide 23

Page 104: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Edge Types in the SCG [Def. 2.1]

Edge e ∈ E has edge type e.type ∈ αa

I Specifies the nature of the particular ordering constraintexpressed by e

I For e.type = α, write e.src →α e.tgt, pronounced “e.srcα-precedes e.tgt”

I n1 →seq n2: sequential successors

I n1 →tick n2: tick successors

I n1 →seq n2, n1 →tick n2: flow successors,induced directly from source program

I �seq: reflexive and transitive closure of →seq

I Note: n1 →seq n2 does not imply fixed run-time orderingbetween n1 and n2 (consider loops)

Synchronous Languages SS 2015, Lecture 13 Slide 23

Page 105: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Mapping SCL & SCG

Plus “;” (Sequence) and “goto” to specify sequential successors(solid edges)

Synchronous Languages SS 2015, Lecture 13 Slide 24

Page 106: rvh/ss15/v-synch/lectures/lecture13.pdf

SCL & SCG – The Control Example

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;6 fork {7 // Thread Request8 Request entry:9 pend = false;

10 if (req)11 pend = true;12 checkReq = req;13 if (pend && grant)14 pend = false;15 pause;16 goto Request entry;17 }18 par {19 // Thread Dispatch20 Dispatch entry:21 grant = false;22 if (checkReq && free)23 grant = true;24 pause;25 goto Dispatch entry;26 }27 join;28 }

Page 107: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.

But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 108: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?

This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 109: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 110: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 111: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads

: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 112: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 113: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance

: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 114: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequentiality vs. ConcurrencyStatic vs. Dynamic Threads

Recall: We want to distinguish between sequential and concurrentcontrol flow.But what do “sequential”/“concurrent” mean?This distinction is not as easy to formalize as it may seem . . .

To get started, distinguish

I Static threads: Structure of a program (based on SCG)

I Dynamic thread instance: thread in execution

Synchronous Languages SS 2015, Lecture 13 Slide 26

Page 115: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 116: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root thread

I With each thread t ∈ T , associate uniqueI entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 117: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined as

I Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 118: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ T

I such that there is a flow path to n that originates in ten andthat does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 119: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n

that originates in ten andthat does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 120: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten

andthat does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 121: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en

, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 122: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 123: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Static Threads [Sec. 2.4]

I Given: SCG G = (N,E )

I Let T denote the set of threads of G

I T includes a top-level Root threadI With each thread t ∈ T , associate unique

I entry node ten ∈ NI exit node tex ∈ N

I Each n ∈ N belongs to a thread th(n) defined asI Immediately enclosing thread t ∈ TI such that there is a flow path to n that originates in ten and

that does not traverse any other entry node t ′en, unless thatflow path subsequently traverses t ′ex also

I For each thread t, define sts(t) as theset of statement nodes n ∈ N such that th(n) = t

Synchronous Languages SS 2015, Lecture 13 Slide 27

Page 124: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T = {Root,Request,Dispatch}I Root thread consists of the statement nodes

sts(Root) = {L0, L7, L28, L29}I The remaining statement nodes of N are partitioned into

sts(Dispatch) and sts(Request)

Page 125: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T =

{Root,Request,Dispatch}I Root thread consists of the statement nodes

sts(Root) = {L0, L7, L28, L29}I The remaining statement nodes of N are partitioned into

sts(Dispatch) and sts(Request)

Page 126: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T = {Root,Request,Dispatch}

I Root thread consists of the statement nodessts(Root) = {L0, L7, L28, L29}

I The remaining statement nodes of N are partitioned intosts(Dispatch) and sts(Request)

Page 127: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T = {Root,Request,Dispatch}I Root thread consists of the statement nodes

sts(Root) = {L0, L7, L28, L29}I The remaining statement nodes of N are partitioned into

sts(Dispatch) and sts(Request)

Page 128: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T = {Root,Request,Dispatch}I Root thread consists of the statement nodes

sts(Root) = {L0, L7, L28, L29}

I The remaining statement nodes of N are partitioned intosts(Dispatch) and sts(Request)

Page 129: rvh/ss15/v-synch/lectures/lecture13.pdf

Threads in Control Example

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Threads T = {Root,Request,Dispatch}I Root thread consists of the statement nodes

sts(Root) = {L0, L7, L28, L29}I The remaining statement nodes of N are partitioned into

sts(Dispatch) and sts(Request)

Page 130: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding ten

I For every thread t 6= Root:p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 131: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 132: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 133: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 134: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:

∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)I Denote this common fork node as lcafork(t1, t2), the least

common ancestor forkI Lift (static) concurrency notion to nodes:

th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 135: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 136: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 137: rvh/ss15/v-synch/lectures/lecture13.pdf

Static Thread Concurrency and Subordination [Def. 2.2]

Let t, t1, t2 be threads in T

I fork(t) =def fork node immediately preceding tenI For every thread t 6= Root:

p(t) =def th(fork(t)), the parent thread

I p∗(t) =def {t, p(t), p(p(t)), . . . , Root}, the recursivelydefined set of ancestor threads of t

I t1 is subordinate to t2, written t1 ≺ t2, if t1 6= t2 ∧ t1 ∈ p∗(t2)

I t1 and t2 are (statically) concurrent, denoted t1 || t2, ifft1 and t2 are descendants of distinct threads sharing acommon fork node, i. e.:∃t ′1 ∈ p∗(t1), t ′2 ∈ p∗(t2) : t ′1 6= t ′2 ∧ fork(t ′1) = fork(t ′2)

I Denote this common fork node as lcafork(t1, t2), the leastcommon ancestor fork

I Lift (static) concurrency notion to nodes:th(n1) || th(n2) ⇒ lcafork(n1, n2) = lcafork(th(n1), th(n2))

Page 138: rvh/ss15/v-synch/lectures/lecture13.pdf

Concurrency and Subordination in Control-Program1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Root ≺ Request and Root ≺ DispatchI Request || Dispatch, Root is not concurrent with any thread

Note: Concurrency on threads, in contrast to concurrency on node instances, ispurely static and can be checked with a simple, syntactic analysis of the programstructure.

Page 139: rvh/ss15/v-synch/lectures/lecture13.pdf

Concurrency and Subordination in Control-Program1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Root ≺ Request and Root ≺ Dispatch

I Request || Dispatch, Root is not concurrent with any thread

Note: Concurrency on threads, in contrast to concurrency on node instances, ispurely static and can be checked with a simple, syntactic analysis of the programstructure.

Page 140: rvh/ss15/v-synch/lectures/lecture13.pdf

Concurrency and Subordination in Control-Program1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Root ≺ Request and Root ≺ DispatchI Request || Dispatch

, Root is not concurrent with any thread

Note: Concurrency on threads, in contrast to concurrency on node instances, ispurely static and can be checked with a simple, syntactic analysis of the programstructure.

Page 141: rvh/ss15/v-synch/lectures/lecture13.pdf

Concurrency and Subordination in Control-Program1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Root ≺ Request and Root ≺ DispatchI Request || Dispatch, Root is not concurrent with any thread

Note: Concurrency on threads, in contrast to concurrency on node instances, ispurely static and can be checked with a simple, syntactic analysis of the programstructure.

Page 142: rvh/ss15/v-synch/lectures/lecture13.pdf

Concurrency and Subordination in Control-Program1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

I Root ≺ Request and Root ≺ DispatchI Request || Dispatch, Root is not concurrent with any thread

Note: Concurrency on threads, in contrast to concurrency on node instances, ispurely static and can be checked with a simple, syntactic analysis of the programstructure.

Page 143: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees [TR, Sec. 3.7]

A Thread Tree illustrates the static thread relationships.I Contains subset of SCG nodes:

1. Entry nodes, labeled with names of their threads2. Fork nodes, attached to the entry nodes of their threads

I Similar to the AND/OR tree of Statecharts

Thread tree for Control example:

Root

L7

Request Dispatch

Synchronous Languages SS 2015, Lecture 13 Slide 31

Page 144: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees [TR, Sec. 3.7]

A Thread Tree illustrates the static thread relationships.I Contains subset of SCG nodes:

1. Entry nodes, labeled with names of their threads2. Fork nodes, attached to the entry nodes of their threads

I Similar to the AND/OR tree of Statecharts

Thread tree for Control example:

Root

L7

Request Dispatch

Synchronous Languages SS 2015, Lecture 13 Slide 31

Page 145: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees [TR, Sec. 3.7]

A Thread Tree illustrates the static thread relationships.I Contains subset of SCG nodes:

1. Entry nodes, labeled with names of their threads2. Fork nodes, attached to the entry nodes of their threads

I Similar to the AND/OR tree of Statecharts

Thread tree for Control example:

Root

L7

Request Dispatch

Synchronous Languages SS 2015, Lecture 13 Slide 31

Page 146: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees – The Reinc2 Example

1 module Reinc22 output int x, y;3 {4 loop:5 fork { // Thread T16 x = 1; }7 par { // Thread T28 fork { // Thread T219 y = 1; }

10 par { // Thread T2211 pause;12 y = 2; }13 join;14 fork { // Thread T2315 y = 3; }16 par { // Thread T2417 x = 2; }18 join}19 join;20 goto loop;21 }

T1 T2

T21 T22

T23 T24

entry

exit

L6: x=1

L9: y=1

L12: y=2

L15: y=3 L17: x=2

Root

L5

T1 T2

L8 L14

T21 T22 T23 T24

Alternative definition forstatic thread concurrency:

I Threads are concurrent iff

their least commonancestor (lca) in threadtree is a fork node

Synchronous Languages SS 2015, Lecture 13 Slide 32

Page 147: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees – The Reinc2 Example

1 module Reinc22 output int x, y;3 {4 loop:5 fork { // Thread T16 x = 1; }7 par { // Thread T28 fork { // Thread T219 y = 1; }

10 par { // Thread T2211 pause;12 y = 2; }13 join;14 fork { // Thread T2315 y = 3; }16 par { // Thread T2417 x = 2; }18 join}19 join;20 goto loop;21 }

T1 T2

T21 T22

T23 T24

entry

exit

L6: x=1

L9: y=1

L12: y=2

L15: y=3 L17: x=2

Root

L5

T1 T2

L8 L14

T21 T22 T23 T24

Alternative definition forstatic thread concurrency:

I Threads are concurrent ifftheir least commonancestor (lca) in threadtree is

a fork node

Synchronous Languages SS 2015, Lecture 13 Slide 32

Page 148: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Trees – The Reinc2 Example

1 module Reinc22 output int x, y;3 {4 loop:5 fork { // Thread T16 x = 1; }7 par { // Thread T28 fork { // Thread T219 y = 1; }

10 par { // Thread T2211 pause;12 y = 2; }13 join;14 fork { // Thread T2315 y = 3; }16 par { // Thread T2417 x = 2; }18 join}19 join;20 goto loop;21 }

T1 T2

T21 T22

T23 T24

entry

exit

L6: x=1

L9: y=1

L12: y=2

L15: y=3 L17: x=2

Root

L5

T1 T2

L8 L14

T21 T22 T23 T24

Alternative definition forstatic thread concurrency:

I Threads are concurrent ifftheir least commonancestor (lca) in threadtree is a fork node

Synchronous Languages SS 2015, Lecture 13 Slide 32

Page 149: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Reincarnation – The Reinc Example

1 module Reinc2 output int x, y;3 {4 loop:5 fork {6 // Thread T17 x = 1;8 }9 par {

10 // Thread T211 pause;12 x = 2;13 }14 join;15 goto loop;16 }

T1 T2

entry

exit

L7: x=1

L12: x=2

Are interested in run-timeconcurrency, i. e., whetherordering is up to discretionof a scheduler.

Observations:

I T2 exhibits threadreincarnation

I Assignments to xare both executed inthe same tick, yetare sequentialized

I Thus, static threadconcurrency notsufficient tocapture run-timeconcurrency!

Synchronous Languages SS 2015, Lecture 13 Slide 33

Page 150: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Reincarnation – The Reinc Example

1 module Reinc2 output int x, y;3 {4 loop:5 fork {6 // Thread T17 x = 1;8 }9 par {

10 // Thread T211 pause;12 x = 2;13 }14 join;15 goto loop;16 }

T1 T2

entry

exit

L7: x=1

L12: x=2

Are interested in run-timeconcurrency, i. e., whetherordering is up to discretionof a scheduler.Observations:

I T2 exhibits threadreincarnation

I Assignments to xare both executed inthe same tick, yetare sequentialized

I Thus, static threadconcurrency notsufficient tocapture run-timeconcurrency!

Synchronous Languages SS 2015, Lecture 13 Slide 33

Page 151: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Reincarnation – The Reinc Example

1 module Reinc2 output int x, y;3 {4 loop:5 fork {6 // Thread T17 x = 1;8 }9 par {

10 // Thread T211 pause;12 x = 2;13 }14 join;15 goto loop;16 }

T1 T2

entry

exit

L7: x=1

L12: x=2

Are interested in run-timeconcurrency, i. e., whetherordering is up to discretionof a scheduler.Observations:

I T2 exhibits threadreincarnation

I Assignments to xare both executed inthe same tick, yetare sequentialized

I Thus, static threadconcurrency notsufficient tocapture run-timeconcurrency!

Synchronous Languages SS 2015, Lecture 13 Slide 33

Page 152: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Reincarnation – The Reinc Example

1 module Reinc2 output int x, y;3 {4 loop:5 fork {6 // Thread T17 x = 1;8 }9 par {

10 // Thread T211 pause;12 x = 2;13 }14 join;15 goto loop;16 }

T1 T2

entry

exit

L7: x=1

L12: x=2

Are interested in run-timeconcurrency, i. e., whetherordering is up to discretionof a scheduler.Observations:

I T2 exhibits threadreincarnation

I Assignments to xare both executed inthe same tick, yetare sequentialized

I Thus, static threadconcurrency notsufficient tocapture run-timeconcurrency!

Synchronous Languages SS 2015, Lecture 13 Slide 33

Page 153: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Thread Reincarnation – The Reinc Example

1 module Reinc2 output int x, y;3 {4 loop:5 fork {6 // Thread T17 x = 1;8 }9 par {

10 // Thread T211 pause;12 x = 2;13 }14 join;15 goto loop;16 }

T1 T2

entry

exit

L7: x=1

L12: x=2

Are interested in run-timeconcurrency, i. e., whetherordering is up to discretionof a scheduler.Observations:

I T2 exhibits threadreincarnation

I Assignments to xare both executed inthe same tick, yetare sequentialized

I Thus, static threadconcurrency notsufficient tocapture run-timeconcurrency!

Synchronous Languages SS 2015, Lecture 13 Slide 33

Page 154: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 155: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 156: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 157: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 158: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 159: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation I

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

I Accesses to x in L7and L11 executed twicewithin tick

I Denote this asstatementreincarnation

I Accesses are(statically) concurrent

I Data dependencies ⇒Must schedule L7before L11

I But only within thesame loop iteration!

Not enough to impose an order on the program statements⇒ Need to distinguish statement instances

Page 160: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 161: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 162: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 163: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 164: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 165: rvh/ss15/v-synch/lectures/lecture13.pdf

Statement Reincarnation II

T1 T2

entry

x = 0; y = 0

exit

L14: y < 2

L7: x += 1 L11: y = x1

ir

true

1 module InstLoop2 output int x = 0, y = 0;3 {4 loop:5 fork {6 // Thread T17 x += 1;8 }9 par {

10 // Thread T211 y = x;12 }13 join;14 if (y < 2)15 goto loop;16 }

/ Traditionalsynchronous languages:Reject

I Instantaneous loopstraditionally forbidden

, SC: Determinate ⇒Accept

I One might still want toensure that a programalways terminates

I But this issue isorthogonal todeterminacy andhaving a well-definedsemantics.

Page 166: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Macroticks [Def. 2.3 + 2.4]

I Given: SCG G = (N,E )

I (Macro) tick R, of length len(R) ∈ N≥1:mapping from micro tick indices 1 ≤ j ≤ len(R),to nodes R(j) ∈ N

A macro tick is also: Linearly ordered set of node instances

I Node instance: ni = (n, i),with statement node n ∈ N,micro tick count i ∈ N

I Can identify macro tick R with set{(n, i) | 1 ≤ i ≤ len(R), n = R(i)}

Synchronous Languages SS 2015, Lecture 13 Slide 36

Page 167: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Macroticks [Def. 2.3 + 2.4]

I Given: SCG G = (N,E )

I (Macro) tick R, of length len(R) ∈ N≥1:mapping from micro tick indices 1 ≤ j ≤ len(R),to nodes R(j) ∈ N

A macro tick is also: Linearly ordered set of node instances

I Node instance: ni = (n, i),with statement node n ∈ N,micro tick count i ∈ N

I Can identify macro tick R with set{(n, i) | 1 ≤ i ≤ len(R), n = R(i)}

Synchronous Languages SS 2015, Lecture 13 Slide 36

Page 168: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Macroticks [Def. 2.3 + 2.4]

I Given: SCG G = (N,E )

I (Macro) tick R, of length len(R) ∈ N≥1:mapping from micro tick indices 1 ≤ j ≤ len(R),to nodes R(j) ∈ N

A macro tick is also: Linearly ordered set of node instances

I Node instance: ni = (n, i),with statement node n ∈ N,micro tick count i ∈ N

I Can identify macro tick R with set{(n, i) | 1 ≤ i ≤ len(R), n = R(i)}

Synchronous Languages SS 2015, Lecture 13 Slide 36

Page 169: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Macroticks [Def. 2.3 + 2.4]

I Given: SCG G = (N,E )

I (Macro) tick R, of length len(R) ∈ N≥1:mapping from micro tick indices 1 ≤ j ≤ len(R),to nodes R(j) ∈ N

A macro tick is also: Linearly ordered set of node instances

I Node instance: ni = (n, i),with statement node n ∈ N,micro tick count i ∈ N

I Can identify macro tick R with set{(n, i) | 1 ≤ i ≤ len(R), n = R(i)}

Synchronous Languages SS 2015, Lecture 13 Slide 36

Page 170: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Run-Time Concurrency [Def. 2.5 + 2.6]Given: macro tick R, index 1 ≤ i ≤ len(R), node n ∈ NDef.: last(n, i) = max{j | j ≤ i ,R(j) = n},retrieves last occurrence of n in R at or before index i . If it doesnot exist, lastR(n, i) = 0.

Given: macro tick R, i1, i2 ∈ N≤len(R), and n1, n2 ∈ N.Def.: Two node instances ni1 = (n1, i1) and ni2 = (n2, i2) are(run-time) concurrent in R, denoted ni1 |R ni2, iff

1. they appear in the micro ticks of R, i. e., n1 = R(i1) andn2 = R(i2),

2. they belong to statically concurrent threads, i. e.,th(n1) || th(n2), and

3. their threads have been instantiated by the same instance ofthe associated least common ancestor fork, i. e.,last(n, i1) = last(n, i2) where n = lcafork(n1, n2)

Synchronous Languages SS 2015, Lecture 13 Slide 37

Page 171: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Run-Time Concurrency [Def. 2.5 + 2.6]Given: macro tick R, index 1 ≤ i ≤ len(R), node n ∈ NDef.: last(n, i) = max{j | j ≤ i ,R(j) = n},retrieves last occurrence of n in R at or before index i . If it doesnot exist, lastR(n, i) = 0.

Given: macro tick R, i1, i2 ∈ N≤len(R), and n1, n2 ∈ N.Def.: Two node instances ni1 = (n1, i1) and ni2 = (n2, i2) are(run-time) concurrent in R, denoted ni1 |R ni2, iff

1. they appear in the micro ticks of R, i. e., n1 = R(i1) andn2 = R(i2),

2. they belong to statically concurrent threads, i. e.,th(n1) || th(n2), and

3. their threads have been instantiated by the same instance ofthe associated least common ancestor fork, i. e.,last(n, i1) = last(n, i2) where n = lcafork(n1, n2)

Synchronous Languages SS 2015, Lecture 13 Slide 37

Page 172: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Run-Time Concurrency [Def. 2.5 + 2.6]Given: macro tick R, index 1 ≤ i ≤ len(R), node n ∈ NDef.: last(n, i) = max{j | j ≤ i ,R(j) = n},retrieves last occurrence of n in R at or before index i . If it doesnot exist, lastR(n, i) = 0.

Given: macro tick R, i1, i2 ∈ N≤len(R), and n1, n2 ∈ N.Def.: Two node instances ni1 = (n1, i1) and ni2 = (n2, i2) are(run-time) concurrent in R, denoted ni1 |R ni2, iff

1. they appear in the micro ticks of R, i. e., n1 = R(i1) andn2 = R(i2),

2. they belong to statically concurrent threads, i. e.,th(n1) || th(n2), and

3. their threads have been instantiated by the same instance ofthe associated least common ancestor fork, i. e.,last(n, i1) = last(n, i2) where n = lcafork(n1, n2)

Synchronous Languages SS 2015, Lecture 13 Slide 37

Page 173: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Run-Time Concurrency [Def. 2.5 + 2.6]Given: macro tick R, index 1 ≤ i ≤ len(R), node n ∈ NDef.: last(n, i) = max{j | j ≤ i ,R(j) = n},retrieves last occurrence of n in R at or before index i . If it doesnot exist, lastR(n, i) = 0.

Given: macro tick R, i1, i2 ∈ N≤len(R), and n1, n2 ∈ N.Def.: Two node instances ni1 = (n1, i1) and ni2 = (n2, i2) are(run-time) concurrent in R, denoted ni1 |R ni2, iff

1. they appear in the micro ticks of R, i. e., n1 = R(i1) andn2 = R(i2),

2. they belong to statically concurrent threads, i. e.,th(n1) || th(n2), and

3. their threads have been instantiated by the same instance ofthe associated least common ancestor fork, i. e.,last(n, i1) = last(n, i2) where n = lcafork(n1, n2)

Synchronous Languages SS 2015, Lecture 13 Slide 37

Page 174: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Run-Time Concurrency [Def. 2.5 + 2.6]Given: macro tick R, index 1 ≤ i ≤ len(R), node n ∈ NDef.: last(n, i) = max{j | j ≤ i ,R(j) = n},retrieves last occurrence of n in R at or before index i . If it doesnot exist, lastR(n, i) = 0.

Given: macro tick R, i1, i2 ∈ N≤len(R), and n1, n2 ∈ N.Def.: Two node instances ni1 = (n1, i1) and ni2 = (n2, i2) are(run-time) concurrent in R, denoted ni1 |R ni2, iff

1. they appear in the micro ticks of R, i. e., n1 = R(i1) andn2 = R(i2),

2. they belong to statically concurrent threads, i. e.,th(n1) || th(n2), and

3. their threads have been instantiated by the same instance ofthe associated least common ancestor fork, i. e.,last(n, i1) = last(n, i2) where n = lcafork(n1, n2)

Synchronous Languages SS 2015, Lecture 13 Slide 37

Page 175: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Overview

Motivation

Formalizing Sequential Constructiveness (SC)The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Wrap-Up

Synchronous Languages SS 2015, Lecture 13 Slide 38

Page 176: rvh/ss15/v-synch/lectures/lecture13.pdf

Continuations & Thread Execution States [Def. 3.1]A continuation c consists of

1. Node c .node ∈ N, denoting the current state of each thread,i. e., the node (statement) that should be executed next,similar to a program counter

2. Status c .status ∈ {active,waiting , pausing}

In a trace (see later slide), round/square/no parentheses aroundn = c .node denote c .status, for enabled continuations c

Page 177: rvh/ss15/v-synch/lectures/lecture13.pdf

Continuations & Thread Execution States [Def. 3.1]A continuation c consists of

1. Node c .node ∈ N, denoting the current state of each thread

,i. e., the node (statement) that should be executed next,similar to a program counter

2. Status c .status ∈ {active,waiting , pausing}

In a trace (see later slide), round/square/no parentheses aroundn = c .node denote c .status, for enabled continuations c

Page 178: rvh/ss15/v-synch/lectures/lecture13.pdf

Continuations & Thread Execution States [Def. 3.1]A continuation c consists of

1. Node c .node ∈ N, denoting the current state of each thread,i. e., the node (statement) that should be executed next,similar to a program counter

2. Status c .status ∈ {active,waiting , pausing}

In a trace (see later slide), round/square/no parentheses aroundn = c .node denote c .status, for enabled continuations c

Page 179: rvh/ss15/v-synch/lectures/lecture13.pdf

Continuations & Thread Execution States [Def. 3.1]A continuation c consists of

1. Node c .node ∈ N, denoting the current state of each thread,i. e., the node (statement) that should be executed next,similar to a program counter

2. Status c .status ∈ {active,waiting , pausing}

In a trace (see later slide), round/square/no parentheses aroundn = c .node denote c .status, for enabled continuations c

Page 180: rvh/ss15/v-synch/lectures/lecture13.pdf

Continuations & Thread Execution States [Def. 3.1]A continuation c consists of

1. Node c .node ∈ N, denoting the current state of each thread,i. e., the node (statement) that should be executed next,similar to a program counter

2. Status c .status ∈ {active,waiting , pausing}

In a trace (see later slide), round/square/no parentheses aroundn = c .node denote c .status, for enabled continuations c

Page 181: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 182: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),

e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 183: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 184: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 185: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 186: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 187: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Continuation Pool & Configuration [Def. 3.2 + 3.3]

Continuation pool: finite set C of continuations

I C is valid if C meets some coherence properties (see [TECS]),e. g., threads in C adhere to thread tree structure

Configuration: pair (C ,M)

I C is continuation pool

I M is memory assigning values to variables accessed by G

A configuration is called valid if C is valid

Synchronous Languages SS 2015, Lecture 13 Slide 40

Page 188: rvh/ss15/v-synch/lectures/lecture13.pdf

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

Macro tick a 1 1Micro tick i 1 2 3 4 5 6 7 8 9 10 11 12 12

Input free t tvars req f fOutput grant ⊥ f fvars pend ⊥ f fLocal var checkReq ⊥ f f

CRoot L0 L7 [L28] [L28]Continuations CRequest ⊥ L8 L10 L11 L13 L14 L14 L14 L14 L14 L16s (L16s)

CDispatch ⊥ L20 L20 L20 L20 L20 L22 L23 L25s (L25s) (L25s) (L25s)

Scheduled nodes Rai L0 L7 L8 L10 L11 L13 L20 L22 L23 L25s L14 L16s

Page 189: rvh/ss15/v-synch/lectures/lecture13.pdf

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

Macro tick a 1 1Micro tick i 1 2 3 4 5 6 7 8 9 10 11 12 12

Input free t tvars req f fOutput grant ⊥ f fvars pend ⊥ f fLocal var checkReq ⊥ f f

CRoot L0 L7 [L28] [L28]Continuations CRequest ⊥ L8 L10 L11 L13 L14 L14 L14 L14 L14 L16s (L16s)

CDispatch ⊥ L20 L20 L20 L20 L20 L22 L23 L25s (L25s) (L25s) (L25s)

Scheduled nodes Rai L0 L7 L8 L10 L11 L13 L20 L22 L23 L25s L14 L16s

Page 190: rvh/ss15/v-synch/lectures/lecture13.pdf

1 module Control2 input bool free, req;3 output bool grant, pend;4 {5 bool checkReq;67 fork {8 // Thread Request9 Request entry:

10 pend = false;11 if (req)12 pend = true;13 checkReq = req;14 if (pend && grant)15 pend = false;16 pause;17 goto Request entry;18 }

19 par {20 // Thread Dispatch21 Dispatch entry:22 grant = false;23 if (checkReq && free)24 grant = true;25 pause;26 goto Dispatch entry;27 }28 join;29 }

Request

Dispatch

L0,2

L7,2

L29,0

L8,2

L20,1

L28,0

L10,2: pend = false

L18,0L17,2

L11,2: req

L12,2: pend = true

L13,2: checkReq=req

L14,0: pend&& grant

L23,1: checkReq&& free

1wr

L15,0: pend = false

L16s,0

true

true

L16d,2

L22,1: grant = false

L27,0 L26,1

1wr

L24,1: grant = true

1wr

L25s,0

true

L25d,1

Macro tick a 2 2Micro tick i 1 2 3 4 5 6 7 8 9 10 11 12 13 13

Input free t tvars req t tOutput grant f f t tvars pend f f t f fLocal var checkReq f t t

CRoot [L28] [L28]Continuations CRequest L16d L10 L11 L12 L13 L14 L14 L14 L14 L14 L14 L15 L16s (L16s)

CDispatch L25d L25d L25d L25d L25d L25d L22 L23 L24 L25s (L25s) (L25s) (L25s) (L25s)

Scheduled nodes Rai L16d L10 L11 L12 L13 L25d L22 L23 L24 L25s L14 L15 L16s

Page 191: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Free Scheduling [Sec. 3.2]

Now define free scheduling, to set the stage for later defining“initialize-update-read” protocol(→ SC-admissible scheduling)

Only restrictions:

1. Execute only ≺-maximal threadsI If there is at least one continuation in Ccur , then there also is a≺-maximal one, because of the finiteness of the continuationpool

2. Do so in an interleaving fashion

Synchronous Languages SS 2015, Lecture 13 Slide 43

Page 192: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Free Scheduling [Sec. 3.2]

Now define free scheduling, to set the stage for later defining“initialize-update-read” protocol(→ SC-admissible scheduling)

Only restrictions:

1. Execute only ≺-maximal threadsI If there is at least one continuation in Ccur , then there also is a≺-maximal one, because of the finiteness of the continuationpool

2. Do so in an interleaving fashion

Synchronous Languages SS 2015, Lecture 13 Slide 43

Page 193: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Free Scheduling [Sec. 3.2]

Now define free scheduling, to set the stage for later defining“initialize-update-read” protocol(→ SC-admissible scheduling)

Only restrictions:

1. Execute only ≺-maximal threadsI If there is at least one continuation in Ccur , then there also is a≺-maximal one, because of the finiteness of the continuationpool

2. Do so in an interleaving fashion

Synchronous Languages SS 2015, Lecture 13 Slide 43

Page 194: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Free Scheduling [Sec. 3.2]

Now define free scheduling, to set the stage for later defining“initialize-update-read” protocol(→ SC-admissible scheduling)

Only restrictions:

1. Execute only ≺-maximal threadsI If there is at least one continuation in Ccur , then there also is a≺-maximal one, because of the finiteness of the continuationpool

2. Do so in an interleaving fashion

Synchronous Languages SS 2015, Lecture 13 Slide 43

Page 195: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps I

Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt) between two

micro ticks

I (Ccur ,Mcur ): current configuration

I c : continuation selected for execution

I (Cnxt ,Mnxt): next configuration

The free schedule is permitted to pick any one of the ≺-maximalcontinuations c ∈ Ccur with c .status = active and execute it in thecurrent memory Mcur

Synchronous Languages SS 2015, Lecture 13 Slide 44

Page 196: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps I

Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt) between two

micro ticks

I (Ccur ,Mcur ): current configuration

I c : continuation selected for execution

I (Cnxt ,Mnxt): next configuration

The free schedule is permitted to pick any one of the ≺-maximalcontinuations c ∈ Ccur with c .status = active and execute it in thecurrent memory Mcur

Synchronous Languages SS 2015, Lecture 13 Slide 44

Page 197: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps II

(Recall:) Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt)

I Executing c yields a new memory Mnxt = µM(c ,Mcur ) and a(possibly empty) set of new continuations µC (c ,Mcur ) bywhich c is replaced, i. e., Cnxt = Ccur \ {c} ∪ µC (c ,Mcur )

I If µC (c ,Mcur ) = ∅: status flags set to active for all c ∈ Cnxt

that become ≺-maximal by eliminating c from C

I Actions µM and µC (made precise in paper) depend on thestatement c.node.st to be executed

I (Cnxt ,Mnxt) uniquely determined by c , thus may write(Cnxt ,Mnxt) = c(Ccur ,Mcur )

Synchronous Languages SS 2015, Lecture 13 Slide 45

Page 198: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps II

(Recall:) Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt)

I Executing c yields a new memory Mnxt = µM(c ,Mcur ) and a(possibly empty) set of new continuations µC (c ,Mcur ) bywhich c is replaced, i. e., Cnxt = Ccur \ {c} ∪ µC (c ,Mcur )

I If µC (c ,Mcur ) = ∅: status flags set to active for all c ∈ Cnxt

that become ≺-maximal by eliminating c from C

I Actions µM and µC (made precise in paper) depend on thestatement c.node.st to be executed

I (Cnxt ,Mnxt) uniquely determined by c , thus may write(Cnxt ,Mnxt) = c(Ccur ,Mcur )

Synchronous Languages SS 2015, Lecture 13 Slide 45

Page 199: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps II

(Recall:) Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt)

I Executing c yields a new memory Mnxt = µM(c ,Mcur ) and a(possibly empty) set of new continuations µC (c ,Mcur ) bywhich c is replaced, i. e., Cnxt = Ccur \ {c} ∪ µC (c ,Mcur )

I If µC (c ,Mcur ) = ∅: status flags set to active for all c ∈ Cnxt

that become ≺-maximal by eliminating c from C

I Actions µM and µC (made precise in paper) depend on thestatement c.node.st to be executed

I (Cnxt ,Mnxt) uniquely determined by c , thus may write(Cnxt ,Mnxt) = c(Ccur ,Mcur )

Synchronous Languages SS 2015, Lecture 13 Slide 45

Page 200: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps II

(Recall:) Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt)

I Executing c yields a new memory Mnxt = µM(c ,Mcur ) and a(possibly empty) set of new continuations µC (c ,Mcur ) bywhich c is replaced, i. e., Cnxt = Ccur \ {c} ∪ µC (c ,Mcur )

I If µC (c ,Mcur ) = ∅: status flags set to active for all c ∈ Cnxt

that become ≺-maximal by eliminating c from C

I Actions µM and µC (made precise in paper) depend on thestatement c.node.st to be executed

I (Cnxt ,Mnxt) uniquely determined by c , thus may write(Cnxt ,Mnxt) = c(Ccur ,Mcur )

Synchronous Languages SS 2015, Lecture 13 Slide 45

Page 201: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Micro Steps II

(Recall:) Micro step: transition (Ccur ,Mcur )c→µs (Cnxt ,Mnxt)

I Executing c yields a new memory Mnxt = µM(c ,Mcur ) and a(possibly empty) set of new continuations µC (c ,Mcur ) bywhich c is replaced, i. e., Cnxt = Ccur \ {c} ∪ µC (c ,Mcur )

I If µC (c ,Mcur ) = ∅: status flags set to active for all c ∈ Cnxt

that become ≺-maximal by eliminating c from C

I Actions µM and µC (made precise in paper) depend on thestatement c.node.st to be executed

I (Cnxt ,Mnxt) uniquely determined by c , thus may write(Cnxt ,Mnxt) = c(Ccur ,Mcur )

Synchronous Languages SS 2015, Lecture 13 Slide 45

Page 202: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 203: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 204: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:

I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 205: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 206: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 207: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps I

Quiescent configuration (C ,M):

I No active c ∈ C

I All c ∈ C pausing or waiting

If C = ∅:I Main program terminated

Otherwise:

I Scheduler can perform a global clock step

Synchronous Languages SS 2015, Lecture 13 Slide 46

Page 208: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps II

Global clock step VI : (Ccur ,Mcur )→tick (Cnxt ,Mnxt)

I Transition between last micro tick of the current macro tickto first micro tick of the subsequent macro tick

I VI is external input

I All pausing continuations of C advance from their surf nodeto the associated depth node:

Cnxt = {c[active :: tick(n)] | c[pausing :: n] ∈ Ccur} ∪{c[waiting :: n] | c[waiting :: n] ∈ Ccur}

Synchronous Languages SS 2015, Lecture 13 Slide 47

Page 209: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps II

Global clock step VI : (Ccur ,Mcur )→tick (Cnxt ,Mnxt)

I Transition between last micro tick of the current macro tickto first micro tick of the subsequent macro tick

I VI is external input

I All pausing continuations of C advance from their surf nodeto the associated depth node:

Cnxt = {c[active :: tick(n)] | c[pausing :: n] ∈ Ccur} ∪{c[waiting :: n] | c[waiting :: n] ∈ Ccur}

Synchronous Languages SS 2015, Lecture 13 Slide 47

Page 210: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps III

Global clock step updates the memory:

I Let I = {x1, x2, . . . , xn} be the designated input variables ofthe SCG, including input/output variables

I Memory is updated by a new set of external input valuesVI = [x1 = v1, . . . , xn = vn] for the next macro tick

I All other memory locations persist unchanged into the nextmacro tick.

Formally,

Mnxt(x) =

{vi , if x = xi ∈ I ,

Mcur (x), if x 6∈ I .

Synchronous Languages SS 2015, Lecture 13 Slide 48

Page 211: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps III

Global clock step updates the memory:

I Let I = {x1, x2, . . . , xn} be the designated input variables ofthe SCG, including input/output variables

I Memory is updated by a new set of external input valuesVI = [x1 = v1, . . . , xn = vn] for the next macro tick

I All other memory locations persist unchanged into the nextmacro tick.

Formally,

Mnxt(x) =

{vi , if x = xi ∈ I ,

Mcur (x), if x 6∈ I .

Synchronous Languages SS 2015, Lecture 13 Slide 48

Page 212: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps III

Global clock step updates the memory:

I Let I = {x1, x2, . . . , xn} be the designated input variables ofthe SCG, including input/output variables

I Memory is updated by a new set of external input valuesVI = [x1 = v1, . . . , xn = vn] for the next macro tick

I All other memory locations persist unchanged into the nextmacro tick.

Formally,

Mnxt(x) =

{vi , if x = xi ∈ I ,

Mcur (x), if x 6∈ I .

Synchronous Languages SS 2015, Lecture 13 Slide 48

Page 213: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Clock Steps III

Global clock step updates the memory:

I Let I = {x1, x2, . . . , xn} be the designated input variables ofthe SCG, including input/output variables

I Memory is updated by a new set of external input valuesVI = [x1 = v1, . . . , xn = vn] for the next macro tick

I All other memory locations persist unchanged into the nextmacro tick.

Formally,

Mnxt(x) =

{vi , if x = xi ∈ I ,

Mcur (x), if x 6∈ I .

Synchronous Languages SS 2015, Lecture 13 Slide 48

Page 214: rvh/ss15/v-synch/lectures/lecture13.pdf

Macro TicksScheduler runs through sequence

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

to reach final quiescent configuration (C ak(a),M

ak(a))

Sequence (1) is macro tick (synchronous instant) a:

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I V aI : projects the initial input, V a

I (x) = Ma0 (x) for x ∈ I

I Mak(a): response of a

Ra: sequence of statement nodes executed during a

I len(Ra) = k(a) is length of a

I Ra is function mapping each micro tick index 1 ≤ j ≤ k(a) tonode Ra(j) = caj .node executed at index j

Page 215: rvh/ss15/v-synch/lectures/lecture13.pdf

Macro TicksScheduler runs through sequence

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

to reach final quiescent configuration (C ak(a),M

ak(a))

Sequence (1) is macro tick (synchronous instant) a:

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I V aI : projects the initial input, V a

I (x) = Ma0 (x) for x ∈ I

I Mak(a): response of a

Ra: sequence of statement nodes executed during a

I len(Ra) = k(a) is length of a

I Ra is function mapping each micro tick index 1 ≤ j ≤ k(a) tonode Ra(j) = caj .node executed at index j

Page 216: rvh/ss15/v-synch/lectures/lecture13.pdf

Macro TicksScheduler runs through sequence

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

to reach final quiescent configuration (C ak(a),M

ak(a))

Sequence (1) is macro tick (synchronous instant) a:

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I V aI : projects the initial input, V a

I (x) = Ma0 (x) for x ∈ I

I Mak(a): response of a

Ra: sequence of statement nodes executed during a

I len(Ra) = k(a) is length of a

I Ra is function mapping each micro tick index 1 ≤ j ≤ k(a) tonode Ra(j) = caj .node executed at index j

Page 217: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Runs and Traces

Run of G : sequence of macro ticks Ra and external inputs V aI

indexed by a ∈ IN≤1, with

I initial continuation pool C 00 = {c0} activates the entry node

of the G ’s Root thread, i.e., c0.node = Root.en andc0.status = active

I all macro tick configurations are connected by clock steps,i.e., (C a

k(a),Mak(a))→tick (C a+1

0 ,Ma+10 )

Trace: externally visible output values at each macro tick R [TR,Sec. 3.9]

Synchronous Languages SS 2015, Lecture 13 Slide 50

Page 218: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Runs and Traces

Run of G : sequence of macro ticks Ra and external inputs V aI

indexed by a ∈ IN≤1, with

I initial continuation pool C 00 = {c0} activates the entry node

of the G ’s Root thread, i.e., c0.node = Root.en andc0.status = active

I all macro tick configurations are connected by clock steps,i.e., (C a

k(a),Mak(a))→tick (C a+1

0 ,Ma+10 )

Trace: externally visible output values at each macro tick R [TR,Sec. 3.9]

Synchronous Languages SS 2015, Lecture 13 Slide 50

Page 219: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Runs and Traces

Run of G : sequence of macro ticks Ra and external inputs V aI

indexed by a ∈ IN≤1, with

I initial continuation pool C 00 = {c0} activates the entry node

of the G ’s Root thread, i.e., c0.node = Root.en andc0.status = active

I all macro tick configurations are connected by clock steps,i.e., (C a

k(a),Mak(a))→tick (C a+1

0 ,Ma+10 )

Trace: externally visible output values at each macro tick R [TR,Sec. 3.9]

Synchronous Languages SS 2015, Lecture 13 Slide 50

Page 220: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Runs and Traces

Run of G : sequence of macro ticks Ra and external inputs V aI

indexed by a ∈ IN≤1, with

I initial continuation pool C 00 = {c0} activates the entry node

of the G ’s Root thread, i.e., c0.node = Root.en andc0.status = active

I all macro tick configurations are connected by clock steps,i.e., (C a

k(a),Mak(a))→tick (C a+1

0 ,Ma+10 )

Trace: externally visible output values at each macro tick R [TR,Sec. 3.9]

Synchronous Languages SS 2015, Lecture 13 Slide 50

Page 221: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

DeterminacyRecall:

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I Macro (tick) configuration: end points of a macro tick (2)

I Micro (tick) configuration: all other intermediateconfigurations (C a

i ,Mai ), 0 < i < k(a) seen in (1)

Synchrony hypothesis:

I only macro configurations are observable externally(in fact, only the memory component of those)

I Suffices to ensure thatsequence of macro ticks =⇒ is determinate

I Micro tick behavior →µs may well be non-determinate

Synchronous Languages SS 2015, Lecture 13 Slide 51

Page 222: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

DeterminacyRecall:

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I Macro (tick) configuration: end points of a macro tick (2)

I Micro (tick) configuration: all other intermediateconfigurations (C a

i ,Mai ), 0 < i < k(a) seen in (1)

Synchrony hypothesis:

I only macro configurations are observable externally(in fact, only the memory component of those)

I Suffices to ensure thatsequence of macro ticks =⇒ is determinate

I Micro tick behavior →µs may well be non-determinate

Synchronous Languages SS 2015, Lecture 13 Slide 51

Page 223: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

DeterminacyRecall:

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I Macro (tick) configuration: end points of a macro tick (2)

I Micro (tick) configuration: all other intermediateconfigurations (C a

i ,Mai ), 0 < i < k(a) seen in (1)

Synchrony hypothesis:

I only macro configurations are observable externally(in fact, only the memory component of those)

I Suffices to ensure thatsequence of macro ticks =⇒ is determinate

I Micro tick behavior →µs may well be non-determinate

Synchronous Languages SS 2015, Lecture 13 Slide 51

Page 224: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

DeterminacyRecall:

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I Macro (tick) configuration: end points of a macro tick (2)

I Micro (tick) configuration: all other intermediateconfigurations (C a

i ,Mai ), 0 < i < k(a) seen in (1)

Synchrony hypothesis:

I only macro configurations are observable externally(in fact, only the memory component of those)

I Suffices to ensure thatsequence of macro ticks =⇒ is determinate

I Micro tick behavior →µs may well be non-determinate

Synchronous Languages SS 2015, Lecture 13 Slide 51

Page 225: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

DeterminacyRecall:

(C a0 ,M

a0 )

ca1→µs (C a1 ,M

a1 )

ca2→µs · · ·cak(a)→ µs (C a

k(a),Mak(a)) (1)

(Ra,V aI ) : (C a

0 ,Ma0 ) =⇒ (C a

k(a),Mak(a)) (2)

I Macro (tick) configuration: end points of a macro tick (2)

I Micro (tick) configuration: all other intermediateconfigurations (C a

i ,Mai ), 0 < i < k(a) seen in (1)

Synchrony hypothesis:

I only macro configurations are observable externally(in fact, only the memory component of those)

I Suffices to ensure thatsequence of macro ticks =⇒ is determinate

I Micro tick behavior →µs may well be non-determinate

Synchronous Languages SS 2015, Lecture 13 Slide 51

Page 226: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Active and Pausing Continuations are Concurrent [TR,Prop. 2]

Given:

I (C ,M), reachable (micro or macro tick) configuration

I c1, c2 ∈ C , active or pausing continuations with c1 6= c2

Then:

I c1.node 6= c2.node

I th(c1.node) || th(c2.node)

(Proof: see [TR])

Synchronous Languages SS 2015, Lecture 13 Slide 52

Page 227: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Active and Pausing Continuations are Concurrent [TR,Prop. 2]

Given:

I (C ,M), reachable (micro or macro tick) configuration

I c1, c2 ∈ C , active or pausing continuations with c1 6= c2

Then:

I c1.node 6= c2.node

I th(c1.node) || th(c2.node)

(Proof: see [TR])

Synchronous Languages SS 2015, Lecture 13 Slide 52

Page 228: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited I

Recall: Want to exploit sequentiality as much as possible

I Thus, consider only run-time concurrent data dependencies

Recall: Static concurrency 6⇒ run-time concurrency

I Consider Reinc example

I Thus, can ignore some statically concurrent data dependencies

Synchronous Languages SS 2015, Lecture 13 Slide 53

Page 229: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited I

Recall: Want to exploit sequentiality as much as possible

I Thus, consider only run-time concurrent data dependencies

Recall: Static concurrency 6⇒ run-time concurrency

I Consider Reinc example

I Thus, can ignore some statically concurrent data dependencies

Synchronous Languages SS 2015, Lecture 13 Slide 53

Page 230: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent?

Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 231: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent?

Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 232: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent?

Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 233: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample:

Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent?

Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 234: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent?

Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 235: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent? Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 236: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent? Yes!

I Assignments to x sequentially ordered?

Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 237: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent? Yes!

I Assignments to x sequentially ordered? Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 238: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent? Yes!

I Assignments to x sequentially ordered? Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!

However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 239: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Concurrency vs. Sequentiality Revisited IIQuestion: Does (static) sequentiality preclude run-time concurrency?

I Then we could ignore data dependenciesbetween nodes that are sequentially ordered

I But the answer is: no

Counterexample: Reinc3 (SCG shown on right)

I Assignments to x run-time concurrent? Yes!

I Assignments to x sequentially ordered? Yes!

Thus, concurrency and (static) sequentiality arenot mutually exclusive, but orthogonal!However, (instantaneous) run-time sequentiality(on node instances) does exclude run-time concur-rency

T1 T2

entry

exit

x=1 x=2

Synchronous Languages SS 2015, Lecture 13 Slide 54

Page 240: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling I

Key to determinacy:

rule out uncertainties due to unknown scheduling mechanism

I Like the synchronous MoC, the SC MoC ensures macro-tickdeterminacy by inducing certain scheduling constraints onvariable accesses

I Unlike the synchronous MoC, the SC MoC tries to takemaximal advantage of the execution order alreadyexpressed by the programmer through sequential commands

I A scheduler can only affect the order of variable accessesthrough concurrent threads

Synchronous Languages SS 2015, Lecture 13 Slide 55

Page 241: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling I

Key to determinacy:rule out uncertainties due to unknown scheduling mechanism

I Like the synchronous MoC, the SC MoC ensures macro-tickdeterminacy by inducing certain scheduling constraints onvariable accesses

I Unlike the synchronous MoC, the SC MoC tries to takemaximal advantage of the execution order alreadyexpressed by the programmer through sequential commands

I A scheduler can only affect the order of variable accessesthrough concurrent threads

Synchronous Languages SS 2015, Lecture 13 Slide 55

Page 242: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling I

Key to determinacy:rule out uncertainties due to unknown scheduling mechanism

I Like the synchronous MoC, the SC MoC ensures macro-tickdeterminacy by inducing certain scheduling constraints onvariable accesses

I Unlike the synchronous MoC, the SC MoC tries to takemaximal advantage of the execution order alreadyexpressed by the programmer through sequential commands

I A scheduler can only affect the order of variable accessesthrough concurrent threads

Synchronous Languages SS 2015, Lecture 13 Slide 55

Page 243: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling II

Recall:

I If variable accesses (within tick) are already sequentialized by→seq, they cannot appear simultaneously in the activecontinuation pool

I Hence, no way for thread scheduler to reorder them and thuslead to a non-determinate outcome

Similarly, threads are not concurrent with parent thread

I Because of path ordering ≺, a parent thread is alwayssuspended when a child thread is in operation

I Thus, not up to scheduler to decide between parent and childthread

I No race conditions between variable accesses performed byparent and child threads; no source of non-determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 56

Page 244: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling II

Recall:

I If variable accesses (within tick) are already sequentialized by→seq, they cannot appear simultaneously in the activecontinuation pool

I Hence, no way for thread scheduler to reorder them and thuslead to a non-determinate outcome

Similarly, threads are not concurrent with parent thread

I Because of path ordering ≺, a parent thread is alwayssuspended when a child thread is in operation

I Thus, not up to scheduler to decide between parent and childthread

I No race conditions between variable accesses performed byparent and child threads; no source of non-determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 56

Page 245: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling II

Recall:

I If variable accesses (within tick) are already sequentialized by→seq, they cannot appear simultaneously in the activecontinuation pool

I Hence, no way for thread scheduler to reorder them and thuslead to a non-determinate outcome

Similarly, threads are not concurrent with parent thread

I Because of path ordering ≺, a parent thread is alwayssuspended when a child thread is in operation

I Thus, not up to scheduler to decide between parent and childthread

I No race conditions between variable accesses performed byparent and child threads; no source of non-determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 56

Page 246: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Free Scheduling II

Recall:

I If variable accesses (within tick) are already sequentialized by→seq, they cannot appear simultaneously in the activecontinuation pool

I Hence, no way for thread scheduler to reorder them and thuslead to a non-determinate outcome

Similarly, threads are not concurrent with parent thread

I Because of path ordering ≺, a parent thread is alwayssuspended when a child thread is in operation

I Thus, not up to scheduler to decide between parent and childthread

I No race conditions between variable accesses performed byparent and child threads; no source of non-determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 56

Page 247: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 248: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 249: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 250: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 251: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:

the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 252: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

The Aim

Want to find a suitable restriction on the “free” scheduler which is

1. easy to compute

2. leaves sufficient room for concurrent implementations

3. still (predictably) sequentializes any concurrent variableaccesses that may conflict and produce unpredictableresponses

In the following, will define such a restriction:the SC-admissible schedules

Synchronous Languages SS 2015, Lecture 13 Slide 57

Page 253: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Guideline for SC-admissibility

I Initialize-Update-Read protocol, for concurrent accesses

I Want to conservatively extend Esterel’s “Write-Readprotocol” (must do emit before testing)

I But does Esterel always follow write-read protocol?

Synchronous Languages SS 2015, Lecture 13 Slide 58

Page 254: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 255: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 256: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCG

I Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 257: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present test

I But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 258: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC

– hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 259: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!

I Observation: second emit is ineffective, i. e., does not changevalue

I One approach: permit concurrent ineffective writes after read

Page 260: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

value

I One approach: permit concurrent ineffective writes after read

Page 261: rvh/ss15/v-synch/lectures/lecture13.pdf

Write After Read Revisitedmodule WriteAfterReadoutput x, y, z;

emit x;[present x thenemit y

end||present y thenemit z

end;emit x

]end

Esterel version

module WriteAfterReadoutput int x, y, z;{x = 1;forky = x;

parz = y;x = 1;

join}

SCL version

SCGI Concurrent emit after present testI But WriteAfterRead is BC – hence should also be SC!I Observation: second emit is ineffective, i. e., does not change

valueI One approach: permit concurrent ineffective writes after read

Page 262: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]

1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 263: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 264: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 265: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 266: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 267: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 268: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 269: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 270: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 271: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 272: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 1st Try [TR, Sec. 5.2]1 module InEffective12 output int x = 2;3 int y;4 {5 fork6 if (x == 2) {7 y = 1;8 x = 79 }

10 else11 y = 012 par13 x = 714 join15 }

If L13 is scheduled before L6:

I L13 is effective

I No out-of-order write

I y = 0

If L13 is scheduled after L8 (and L6):

I L13 is out-of-order write

I However, L13 is ineffective

I y = 1 (→ non-determinacy!)

I The problem: L8 hides thepotential effectiveness of L13 wrt.L6!

I Both schedules would be permitted under a scheduling regimethat permits ineffective writes

I → Strengthen notion of “ineffective writes”:

I Consider writes “ineffective” only if they do not change read!

Page 273: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 274: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 275: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 276: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 277: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 278: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 279: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 280: rvh/ss15/v-synch/lectures/lecture13.pdf

Ineffectiveness – 2nd Try

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

“x = x xor true”

I Relative writes

I Equivalent to “x = !x”

Sequence L13; L6; L11:

I y = 0

Sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = true, which is whatL6 read!

I y = 1 (→ again non-determinacy!)

I Again, both schedules would be permitted under a schedulingregime that permits ineffective writes

I → Replace “ineffectiveness” by “confluence”

Page 281: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Overview

Motivation

Formalizing Sequential Constructiveness (SC)The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Wrap-Up

Synchronous Languages SS 2015, Lecture 13 Slide 62

Page 282: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Combination Functions [Def. 4.1]

Combination function f :

I f (f (x , e1), e2) = f (f (x , e2), e1)for all x and all side-effect free expressions e1, e2

I Sufficient condition: f is commutative and associative

I Examples: *, +, –, max, and, or

Synchronous Languages SS 2015, Lecture 13 Slide 63

Page 283: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Combination Functions [Def. 4.1]

Combination function f :

I f (f (x , e1), e2) = f (f (x , e2), e1)for all x and all side-effect free expressions e1, e2

I Sufficient condition:

f is commutative and associative

I Examples: *, +, –, max, and, or

Synchronous Languages SS 2015, Lecture 13 Slide 63

Page 284: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Combination Functions [Def. 4.1]

Combination function f :

I f (f (x , e1), e2) = f (f (x , e2), e1)for all x and all side-effect free expressions e1, e2

I Sufficient condition: f is commutative and associative

I Examples:

*, +, –, max, and, or

Synchronous Languages SS 2015, Lecture 13 Slide 63

Page 285: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Combination Functions [Def. 4.1]

Combination function f :

I f (f (x , e1), e2) = f (f (x , e2), e1)for all x and all side-effect free expressions e1, e2

I Sufficient condition: f is commutative and associative

I Examples: *, +, –, max, and, or

Synchronous Languages SS 2015, Lecture 13 Slide 63

Page 286: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 287: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 288: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 289: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are

confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 290: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 291: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++

, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 292: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x

, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 293: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 294: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 295: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 296: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0

, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 297: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5

, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 298: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Relative and Absolute Writes [Def. 4.2]

Relative writes, of type f (“increment” / “modify”): x = f (x , e)

I f must be a combination function

I Evaluation of e must be free of side effects

I Thus, schedules’x = f (x , e1); x = f (x , e2)’ and’x = f (x , e2); x = f (x , e1)’ yield same result for x

I Thus, writes are confluent

I E.g., x++, x = 5*x, x = x-10

Absolute writes (“write” / “initialize”): x = e

I Writes that are not relative

I E.g., x = 0, x = 2*y+5, x = f(z)

Synchronous Languages SS 2015, Lecture 13 Slide 64

Page 299: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

iur Relations [Def. 4.3]

Given two statically concurrent accesses n1 ‖ n2 on some variablex , we define the iur relations

I n1 →ww n2 iff n1 and n2 both initialize x or both performupdates of different type. We call this a ww conflict

I n1 →iu n2 iff n1 initializes x and n2 updates x

I n1 →ur n2 iff n1 updates x and n2 reads x

I n1 →ir n2 iff n1 initializes x and n2 reads x

Since n1 →ww n2 implies n2 →ww n1:

I abbreviate the conjunction of n1 →ww n2 and n2 →ww n1 withn1 ↔ww n2

I by symmetry →ww implies ↔ww

Synchronous Languages SS 2015, Lecture 13 Slide 65

Page 300: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

iur Relations [Def. 4.3]

Given two statically concurrent accesses n1 ‖ n2 on some variablex , we define the iur relations

I n1 →ww n2 iff n1 and n2 both initialize x or both performupdates of different type. We call this a ww conflict

I n1 →iu n2 iff n1 initializes x and n2 updates x

I n1 →ur n2 iff n1 updates x and n2 reads x

I n1 →ir n2 iff n1 initializes x and n2 reads x

Since n1 →ww n2 implies n2 →ww n1:

I abbreviate the conjunction of n1 →ww n2 and n2 →ww n1 withn1 ↔ww n2

I by symmetry →ww implies ↔ww

Synchronous Languages SS 2015, Lecture 13 Slide 65

Page 301: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

iur Relations [Def. 4.3]

Given two statically concurrent accesses n1 ‖ n2 on some variablex , we define the iur relations

I n1 →ww n2 iff n1 and n2 both initialize x or both performupdates of different type. We call this a ww conflict

I n1 →iu n2 iff n1 initializes x and n2 updates x

I n1 →ur n2 iff n1 updates x and n2 reads x

I n1 →ir n2 iff n1 initializes x and n2 reads x

Since n1 →ww n2 implies n2 →ww n1:

I abbreviate the conjunction of n1 →ww n2 and n2 →ww n1 withn1 ↔ww n2

I by symmetry →ww implies ↔ww

Synchronous Languages SS 2015, Lecture 13 Slide 65

Page 302: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

iur Relations [Def. 4.3]

Given two statically concurrent accesses n1 ‖ n2 on some variablex , we define the iur relations

I n1 →ww n2 iff n1 and n2 both initialize x or both performupdates of different type. We call this a ww conflict

I n1 →iu n2 iff n1 initializes x and n2 updates x

I n1 →ur n2 iff n1 updates x and n2 reads x

I n1 →ir n2 iff n1 initializes x and n2 reads x

Since n1 →ww n2 implies n2 →ww n1:

I abbreviate the conjunction of n1 →ww n2 and n2 →ww n1 withn1 ↔ww n2

I by symmetry →ww implies ↔ww

Synchronous Languages SS 2015, Lecture 13 Slide 65

Page 303: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C ,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 304: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C

,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 305: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C ,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 306: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C ,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 307: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C ,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 308: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Nodes [Def. 4.4]Given:

I Valid configuration (C ,M) of SCG

I Nodes n1, n2 ∈ N

n1, n2 are conflicting in (C ,M) iff

1. n1, n2 active in C ,i. e., ∃c1, c2 ∈ C withci .status = active and ni = ci .node

2. c1(c2(C ,M)) 6= c2(c1(C ,M))

n1, n2 are confluent with each other in (C ,M),written: n1 ∼(C ,M) n2, iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Synchronous Languages SS 2015, Lecture 13 Slide 66

Page 309: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence

(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations I

I Confluence is taken relative to valid configurations (C ,M)and indirectly as the absence of conflicts

I Instead of requiring that confluent nodes commute with eachother for arbitrary memories, we only consider thoseconfigurations (C ′,M ′) that are reachable from (C ,M)

I E. g., if it happens for a given program that in all memoriesM ′ reachable from a configuration (C ,M) two expressions ex1and ex2 evaluate to the same value, then the assignments x =ex1 and x = ex2 are confluent in (C ,M)

Synchronous Languages SS 2015, Lecture 13 Slide 67

Page 310: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations II

I Similarly, if the two assignments are never jointly active in anyreachable continuation pool C ′, they are confluent in (C ,M),too

I Thus, statements may be confluent for some program relativeto some reachable configuration, but not for otherconfigurations or in another program

I However, notice that relative writes of the same type areconfluent in the absolute sense, i. e., for all validconfigurations (C ,M) of all programs

Synchronous Languages SS 2015, Lecture 13 Slide 68

Page 311: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations II

I Similarly, if the two assignments are never jointly active in anyreachable continuation pool C ′, they are confluent in (C ,M),too

I Thus, statements may be confluent for some program relativeto some reachable configuration, but not for otherconfigurations or in another program

I However, notice that relative writes of the same type areconfluent in the absolute sense, i. e., for all validconfigurations (C ,M) of all programs

Synchronous Languages SS 2015, Lecture 13 Slide 68

Page 312: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations III

I Confluence n1 ∼(C ,M) n2 requires conflict-freeness for allconfigurations (C ′,M ′) reachable from (C ,M) by arbitrarymicro-sequences under free scheduling

I Will use this notion of confluence to define the restricted setof SC-admissible macro ticks

I Since compiler will ensure SC-admissibility of the executionschedule,one might be tempted to define confluence relative to theseSC-admissible schedules;however, this would result in a logical cycle

Synchronous Languages SS 2015, Lecture 13 Slide 69

Page 313: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations III

I Confluence n1 ∼(C ,M) n2 requires conflict-freeness for allconfigurations (C ′,M ′) reachable from (C ,M) by arbitrarymicro-sequences under free scheduling

I Will use this notion of confluence to define the restricted setof SC-admissible macro ticks

I Since compiler will ensure SC-admissibility of the executionschedule,one might be tempted to define confluence relative to theseSC-admissible schedules;

however, this would result in a logical cycle

Synchronous Languages SS 2015, Lecture 13 Slide 69

Page 314: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations III

I Confluence n1 ∼(C ,M) n2 requires conflict-freeness for allconfigurations (C ′,M ′) reachable from (C ,M) by arbitrarymicro-sequences under free scheduling

I Will use this notion of confluence to define the restricted setof SC-admissible macro ticks

I Since compiler will ensure SC-admissibility of the executionschedule,one might be tempted to define confluence relative to theseSC-admissible schedules;however, this would result in a logical cycle

Synchronous Languages SS 2015, Lecture 13 Slide 69

Page 315: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations IVI This relative view of confluence keeps the scheduling

constraints on SC-admissible macro ticks sufficiently weak

I Note: two nodes confluent in some configuration are stillconfluent in every later configuration reached through anarbitrary sequence of micro steps

I However, more nodes may become confluent in laterconfigurations, because some conflicting configurations are nolonger reachable

I Exploit this in following definition of confluence of nodeinstances by making confluence of node instances within amacro tick relative to the index position at which they occur

Synchronous Languages SS 2015, Lecture 13 Slide 70

Page 316: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations IVI This relative view of confluence keeps the scheduling

constraints on SC-admissible macro ticks sufficiently weakI Note: two nodes confluent in some configuration are still

confluent in every later configuration reached through anarbitrary sequence of micro steps

I However, more nodes may become confluent in laterconfigurations, because some conflicting configurations are nolonger reachable

I Exploit this in following definition of confluence of nodeinstances by making confluence of node instances within amacro tick relative to the index position at which they occur

Synchronous Languages SS 2015, Lecture 13 Slide 70

Page 317: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations IVI This relative view of confluence keeps the scheduling

constraints on SC-admissible macro ticks sufficiently weakI Note: two nodes confluent in some configuration are still

confluent in every later configuration reached through anarbitrary sequence of micro steps

I However, more nodes may become confluent in laterconfigurations, because some conflicting configurations are nolonger reachable

I Exploit this in following definition of confluence of nodeinstances by making confluence of node instances within amacro tick relative to the index position at which they occur

Synchronous Languages SS 2015, Lecture 13 Slide 70

Page 318: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Notes on Confluence(From definition:) n1 ∼(C ,M) n2 iff

I 6 ∃ Sequence of micro steps (C ,M)�µs (C ′,M ′)such that n1 and n2 are conflicting in (C ′,M ′)

Observations IVI This relative view of confluence keeps the scheduling

constraints on SC-admissible macro ticks sufficiently weakI Note: two nodes confluent in some configuration are still

confluent in every later configuration reached through anarbitrary sequence of micro steps

I However, more nodes may become confluent in laterconfigurations, because some conflicting configurations are nolonger reachable

I Exploit this in following definition of confluence of nodeinstances by making confluence of node instances within amacro tick relative to the index position at which they occur

Synchronous Languages SS 2015, Lecture 13 Slide 70

Page 319: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Node Instances [Def. 4.5]

Given:

I Macro tick R

I (Ci ,Mi ) for 0 ≤ i ≤ len(R), the configurations of R

I Node instances ni1 = (n1, i1) and ni2 = (n2, i2) in R

, i. e.,1 ≤ i1, i2 ≤ len(R), n1 = R(i1), n2 = R(i2)

Call node instances confluent in R, written ni1 ∼R ni2, iff

I for i = min(i1, i2)− 1

I n1 ∼(Ci ,Mi ) n2

Synchronous Languages SS 2015, Lecture 13 Slide 71

Page 320: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Node Instances [Def. 4.5]

Given:

I Macro tick R

I (Ci ,Mi ) for 0 ≤ i ≤ len(R), the configurations of R

I Node instances ni1 = (n1, i1) and ni2 = (n2, i2) in R, i. e.,1 ≤ i1, i2 ≤ len(R), n1 = R(i1), n2 = R(i2)

Call node instances confluent in R, written ni1 ∼R ni2, iff

I for i = min(i1, i2)− 1

I n1 ∼(Ci ,Mi ) n2

Synchronous Languages SS 2015, Lecture 13 Slide 71

Page 321: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Node Instances [Def. 4.5]

Given:

I Macro tick R

I (Ci ,Mi ) for 0 ≤ i ≤ len(R), the configurations of R

I Node instances ni1 = (n1, i1) and ni2 = (n2, i2) in R, i. e.,1 ≤ i1, i2 ≤ len(R), n1 = R(i1), n2 = R(i2)

Call node instances confluent in R, written ni1 ∼R ni2, iff

I for i = min(i1, i2)− 1

I n1 ∼(Ci ,Mi ) n2

Synchronous Languages SS 2015, Lecture 13 Slide 71

Page 322: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Confluence of Node Instances [Def. 4.5]

Given:

I Macro tick R

I (Ci ,Mi ) for 0 ≤ i ≤ len(R), the configurations of R

I Node instances ni1 = (n1, i1) and ni2 = (n2, i2) in R, i. e.,1 ≤ i1, i2 ≤ len(R), n1 = R(i1), n2 = R(i2)

Call node instances confluent in R, written ni1 ∼R ni2, iff

I for i = min(i1, i2)− 1

I n1 ∼(Ci ,Mi ) n2

Synchronous Languages SS 2015, Lecture 13 Slide 71

Page 323: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 324: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 325: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 326: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 327: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 328: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 329: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 330: rvh/ss15/v-synch/lectures/lecture13.pdf

InEffective2 Revisited

1 module InEffective22 output bool x = false;3 int y;4 {5 fork6 if (!x) {7 y = 1;8 x = x xor true9 }

10 else11 y = 012 par13 x = x xor true;14 join15 }

Recall sequence L6; L7; L8; L13:

I Q: Is L13 ineffective relative to L6?

I A: Yes!

I L13 is out-of-order . . .

I but writes x = false, which is whatL6 read!

I Q: Are L6 and L13 confluent?

I A: No!

I L6 and L13 conflict at point ofexecution of L6

→ Def. of SC-admissibility – specifically, the underlying schedulingrelations – uses confluence condition

Page 331: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Scheduling Relations [Def 4.6]

Given:

I Macro tick R with

I Node instances ni1,2 = (n1,2, i1,2), i. e., 1 ≤ i1,2 ≤ len(R) andn1,2 = R(i1,2)

I ni1,2 concurrent in R, i. e., ni1 |R ni2I ni1,2 not confluent in R, i. e., ni1 6∼R ni2

Then:

I ni1 →Rα ni2 iff n1 →α n2 for some α ∈ αiur

I ni1 →R ni2 iff i1 < i2; i. e., ni1 happens before ni2 in R.

Synchronous Languages SS 2015, Lecture 13 Slide 73

Page 332: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequential Admissibility [Def. 4.7]

A macro tick R is SC-admissible iff

I for all node instances ni1,2 = (n1,2, i1,2) in R, with1 ≤ i1,2 ≤ len(R) and n1,2 = R(i1,2),

I for all α ∈ αiur

the scheduling condition SCα holds:

if ni1 →Rα ni2 then ni1 →R ni2.

A run for an SCG is SC-admissible if all macro ticks R in this runare SC-admissible.

Synchronous Languages SS 2015, Lecture 13 Slide 74

Page 333: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequential Admissibility [Def. 4.7]

A macro tick R is SC-admissible iff

I for all node instances ni1,2 = (n1,2, i1,2) in R, with1 ≤ i1,2 ≤ len(R) and n1,2 = R(i1,2),

I for all α ∈ αiur

the scheduling condition SCα holds:if ni1 →R

α ni2 then ni1 →R ni2.

A run for an SCG is SC-admissible if all macro ticks R in this runare SC-admissible.

Synchronous Languages SS 2015, Lecture 13 Slide 74

Page 334: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 335: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 336: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs?

Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 337: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 338: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate?

No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 339: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 340: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 341: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module NonDet2 output bool x = false, y = false;3 {4 fork { // Thread CheckX5 if (!x)6 y = true;7 }8 par { // Thread CheckY9 if (!y)

10 x = true11 }12 join13 }

I Admissible runs? Yes, multiple

I Determinate? No

CheckX CheckY

entry

x = false; y = false

exit

if !x

y = true

true

if !y1

wrx = true

true1wr

Thus: SC-admissibility 6⇒ Determinacy

Synchronous Languages SS 2015, Lecture 13 Slide 75

Page 342: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy

1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 343: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 344: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs?

No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 345: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 346: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate?

Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 347: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 348: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

SC-admissibility vs. Determinacy1 module Fail2 output bool z = false;3 {4 fork {5 if (!z)6 z = true;7 }8 par {9 if (z)

10 z = true11 }12 join13 }

I Admissible runs? No

I Determinate? Yes

Thus: Determinacy 6⇒ SC-admissibility

Synchronous Languages SS 2015, Lecture 13 Slide 76

Page 349: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

The SC Language (SCL) and the SC Graph (SCG) [Sec. 2]Free Scheduling of SCGs [Sec. 3]The SC Model of Computation [Sec. 4]

Sequential Constructiveness [Def. 4.8]

Definition: A program P is sequentially constructive (SC) iff foreach initial configuration and input sequence:

1. There exists an SC-admissible run (P is reactive)

2. Every SC-admissible run generates the same determinatesequence of macro responses (P is determinate)

Synchronous Languages SS 2015, Lecture 13 Slide 77

Page 350: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Overview

Motivation

Formalizing Sequential Constructiveness (SC)

Wrap-UpSynchronous Program ClassesSummary

Synchronous Languages SS 2015, Lecture 13 Slide 78

Page 351: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC) Acyclic

Schedulable (ASC)

Sequences of values

Static cycles Dynamic scheduling

Page 352: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Sequences of values

Static cycles Dynamic scheduling

Page 353: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC)

Logically Correct (LC) Berry

Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

Page 354: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

Page 355: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Page 356: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes [TR, Sec. 9]

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Page 357: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PAPS =

if (x) x = 1

Page 358: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PAPS = if (x) x = 1

Page 359: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PAS =

if (!x) x = 1

Page 360: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PAS = if (!x) x = 1

Page 361: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PALS =

if (!x) x = 1 else x = 1

Page 362: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PALS = if (!x) x = 1 else x = 1

Page 363: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PALPS =

if (!x && y) {x = 1; y = 1}

Page 364: rvh/ss15/v-synch/lectures/lecture13.pdf

Synchronous Program Classes

Sequentially Constructive (SC)

Logically Correct (LC)

Pnueli-Shalev (PC)

Berry Constructive (BC)

Acyclic Schedulable

(ASC)

Speculate on absence

Speculate on absence or presence

Sequences of values

Static cycles Dynamic scheduling

Out-of-order scheduling

PP

PS

PAS

PAPS

PALPS

PALS

PABLPS

PBLPS

PPS PLS

PL

PLP

PLPS

NonDet  

or concurrent writes

Cycle of concurrent

dependencies,

All Programs

Example PALPS = if (!x && y) {x = 1; y = 1}

Page 365: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Summary

Underlying idea of sequential constructiveness rather simple

I Prescriptive instead of descriptive sequentiality

I Thus circumventing “spurious” causality problems

I Initialize-update-read protocol

However, precise definition of SC MoC not trivial

I Challenging to ensure conservativeness relative toBerry-constructiveness

I Plain initialize-update-read protocol does not accomodate,e. g., signal re-emissions

I Restricting attention to concurrent, non-confluent nodeinstances is key

Synchronous Languages SS 2015, Lecture 13 Slide 84

Page 366: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Summary

Underlying idea of sequential constructiveness rather simple

I Prescriptive instead of descriptive sequentiality

I Thus circumventing “spurious” causality problems

I Initialize-update-read protocol

However, precise definition of SC MoC not trivial

I Challenging to ensure conservativeness relative toBerry-constructiveness

I Plain initialize-update-read protocol does not accomodate,e. g., signal re-emissions

I Restricting attention to concurrent, non-confluent nodeinstances is key

Synchronous Languages SS 2015, Lecture 13 Slide 84

Page 367: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Summary

Underlying idea of sequential constructiveness rather simple

I Prescriptive instead of descriptive sequentiality

I Thus circumventing “spurious” causality problems

I Initialize-update-read protocol

However, precise definition of SC MoC not trivial

I Challenging to ensure conservativeness relative toBerry-constructiveness

I Plain initialize-update-read protocol does not accomodate,e. g., signal re-emissions

I Restricting attention to concurrent, non-confluent nodeinstances is key

Synchronous Languages SS 2015, Lecture 13 Slide 84

Page 368: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Conclusions

I Clocked, synchronous model of execution for imperative,shared-memory multi-threading

I Conservatively extends synchronous programming (Esterel) bystandard sequential control flow (Java, C)

I =⇒ Deterministic concurrency with synchronousfoundations, but without synchronous restrictions

I , Expressive and intuitive sequential paradigmI , Predictable concurrent threads

Synchronous Languages SS 2015, Lecture 13 Slide 85

Page 369: rvh/ss15/v-synch/lectures/lecture13.pdf

MotivationFormalizing Sequential Constructiveness (SC)

Wrap-Up

Synchronous Program ClassesSummary

Future Work

Plenty of extensions/adaptations possible . . .

I Alternative notions of sequential constructiveness:I A truly “constructive” approach that sharpens SC admissibility

to determinate schedulesI Extension of iur-protocol, e. g., to model ForeC

I Improved synthesis & analysis — see also next lecture

Synchronous Languages SS 2015, Lecture 13 Slide 86