Staged Events Tiago Salmito tsalmito@inf.puc-rio.br Ana Lcia de - - PowerPoint PPT Presentation

staged events
SMART_READER_LITE
LIVE PREVIEW

Staged Events Tiago Salmito tsalmito@inf.puc-rio.br Ana Lcia de - - PowerPoint PPT Presentation

A Flexible Approach to Staged Events Tiago Salmito tsalmito@inf.puc-rio.br Ana Lcia de Moura Noemi Rodriguez 6th International Workshop on Parallel Programming Models and Systems Software for High-End Computing (P2S2) October 1 st 2013


slide-1
SLIDE 1

A Flexible Approach to Staged Events

6th International Workshop on Parallel Programming Models and Systems Software for High-End Computing (P2S2) October 1st 2013 – Lyon, France

Tiago Salmito

tsalmito@inf.puc-rio.br

Ana Lúcia de Moura Noemi Rodriguez

slide-2
SLIDE 2

Stack management Task management Preemptive Cooperative Automatic Manual Event-driven Cooperative threads Multithread

* A. Adya, J. Howell, M. Theimer, W. J. Bolosky and J. R. Douceur. Cooperative Task Management Without Manual Stack Management. (2002)

Concurrency Models

2

slide-3
SLIDE 3

Hybrid Concurrency Models

  • Models combining threads and events
  • Programing model bias:

– Hybrid event-driven

  • More than one concurrent event loops

– Hybrid thread based

  • Converts (user) threads to cooperative events during

runtime

– Staged event-driven

  • Does not have a clear bias towards events or threads
  • Pipeline processing

3

slide-4
SLIDE 4

4

slide-5
SLIDE 5

The Staged Model

  • Inspired by SEDA

– Staged Event-Driven Architecture

  • Flexibility

– Exposes both concurrency models

  • Characteristics:

– Applications are designed as a collection of stages – Stages are multithreaded modules – Asynchronous processing (event-driven communication)

  • Decoupled scheduling

– Local policies – Resource aware

5

slide-6
SLIDE 6

Stages

6

Stage Event handler

Dispatch events Event queue Observe state Adjust parameters ... Thread pool

Scheduler

Controller

slide-7
SLIDE 7

Stages: Some issues

  • Coupling

– Specification

  • Hinder reuse

– Execution

  • Single (shared) address space
  • Use of operating system threads

– Thread sharing

  • Local and global state sharing

– Race conditions – Distributed resources

7

slide-8
SLIDE 8

Extending the Staged Model

  • Objective: Decoupling

– Decisions related to the application logic and decisions related to the execution environment

  • Characteristics

– Stepwise application development – Stage composition and reuse – Cooperative execution with multiple threads

8

slide-9
SLIDE 9

PCAM Design Methodology

  • Partitioning

– Functional or domain decomposition

  • Communication

– Data exchange

  • Agglomeration

– Processing and communication granularity

  • Mapping

– Mapping tasks to processors

9

Problem Partitioning Communication Agglomeration Mapping

slide-10
SLIDE 10

Stepwise development

  • Programming Stages

– Functional decomposition – State isolation

  • Transient state

– Domain decomposition

  • Persistent state

– Atomic execution

  • Communication

– Connectors: Application graph – Output ports and event queues

  • Agglomeration

– Clusters of stages – Scheduling domain

  • Mapping

– Execution locality

10

Communication Programming Stage

Event handler

Stage

Event handler

Stage

Event handler ...

1 2 3 4 5

Connector

Agglomeration 3 5 Mapping Process 1 1 2 Controller Process 2 3 4 Controller Process 3 5 Controller

Cluster

1 2 4

slide-11
SLIDE 11

Leda

  • Distributed platform for staged applications
  • Implemented in C and Lua

– Scripting environment – Use of C for CPU-intensive operations

  • Declarative application description

– Application graph – Execution configuration

11

slide-12
SLIDE 12

Example: echo server

12

require 'leda' local port=5000 local server=leda.stage{ handler=function() local server_sock=assert(socket.bind("*", port)) while true do local cli_sock=assert(server_sock:accept()) leda.send("client",cli_sock) end end, init=function() require'leda.utils.socket' end, }:push() local reader=leda.stage{ handler=function(sock) repeat local msg,err=sock:receive() leda.send("message",msg) until msg==nil end } local echo=leda.stage(function(msg) print(msg) end) local graph=leda.graph{ server"client"..reader, reader"message"..echo } graph:run()

slide-13
SLIDE 13

Evaluation

13

Workgen Reducer Stage 1 Stage 2 Stage 3

slide-14
SLIDE 14

Internal statistics

Worst case scenario Best case scenario

14

slide-15
SLIDE 15

Final Remarks

  • Hybrid concurrency

– Event-driven, thread based or staged

  • An extension to the staged model

– Stepwise application development

  • Implementation of a distributed platform for

staged applications

– Leda

15

slide-16
SLIDE 16

A Flexible Approach to Staged Events

6th International Workshop on Parallel Programming Models and Systems Software for High-End Computing (P2S2) October 1st 2013 – Lyon, France

Tiago Salmito

tsalmito@inf.puc-rio.br

Ana Lúcia de Moura Noemi Rodriguez

slide-17
SLIDE 17

Extra: Runtime Architecture

17

Process 1 S2 S3 S5 S4 S7 S1 S6 S8 Application Ready queue Thread Thread Thread Thread pool Controller To/from

  • ther

processes Cluster Instances Scheduler To process 2 S1 S2 S3 S4 Idle instances Marshalling S1 S2 S3 S4 Event queues S2 S3 S4 S1 I/O interfaces Asynchronous events Waiting instances Thread Cluster 1 Cluster 2 Runtime Statistics