odog : a framework for concurrent and distributed software design

34
ODOG Um ambiente para programação concorrente e distribuída Baseada em Componentes [email protected] Ivan Joker Jeukens https://github.com/ivanjokerbr/odog.git

Upload: ivanjokerbr

Post on 18-Jul-2015

68 views

Category:

Software


4 download

TRANSCRIPT

Page 1: Odog : A Framework for Concurrent and Distributed software design

ODOG

Um ambiente para programação concorrente e distribuída Baseada em Componentes

[email protected]

Ivan Joker Jeukens

https://github.com/ivanjokerbr/odog.git

Page 2: Odog : A Framework for Concurrent and Distributed software design

Introduction

● Theory

– Concepts

– Related Work

– ODOG

– Interaction Semantics● Code

● Demos

● Future Work

Page 3: Odog : A Framework for Concurrent and Distributed software design

THEORY

Page 4: Odog : A Framework for Concurrent and Distributed software design

Concepts

Component abstraction

Composition of components

A B

compositioninteraction medium

communication channel

component

Two different kinds of languages

for the composition (coordination)

for the components (host)

Page 5: Odog : A Framework for Concurrent and Distributed software design

Concepts

Coordination language

syntax : block oriented

semantics : interaction semantics

Host language

programming languages

domain specific languages

What can I do with such a model ?

generate an executable code

“simulation” or actual code production

Page 6: Odog : A Framework for Concurrent and Distributed software design

Concepts

What are the advantages ?

Create programming abstractions more natural to the application domain

more productivity

better understanding

better optimization opportunities

Better semantics (no non-determinism, or a controlled one)

Possibility to target to any desired platform, hiding the details from the programmer

Page 7: Odog : A Framework for Concurrent and Distributed software design

Related work

Is this idea original ? No

Labview - National Instruments

Page 8: Odog : A Framework for Concurrent and Distributed software design

Related Work (2)

Simulink - Mathworks

Page 9: Odog : A Framework for Concurrent and Distributed software design

Related Work (3)

Scade – Esterel Technologies

Page 10: Odog : A Framework for Concurrent and Distributed software design

ODOG

Project Requirements

support any interaction semantics

support any programming language

easily generate efficient code for the system being described

have a strong validation flow

be open source

Common solution

class libraries for syntax and semantics

not good for 2, 3

Page 11: Odog : A Framework for Concurrent and Distributed software design

Simple

Tree structure for the abstract syntax

XML

Template based code generation for interaction semantics

Avoid the need for (difficult and error prone) code analysis and transformation

code “as good as it gets”

ODOG's Solution

Page 12: Odog : A Framework for Concurrent and Distributed software design

Standard ODOG Flow

Component selection and composition

Component implementationInteraction Semantics

selection

Rule Checking

Code Generation

Validation

Concepts

External Flow

Solution to be characterized

Page 13: Odog : A Framework for Concurrent and Distributed software design

ODOG v1.0

3 Interaction semantics

Discrete Events (DE) : simulation

Dataflow (DF): data stream processing

Synchronous (SR): software based on response to events

2 Platforms

host : generates code for your machine so you can test your ideas

multicore : generates code for DF exploiting parallelism

OmapH2 : deprected

GUI for editing and Rule Checker for validation

Page 14: Odog : A Framework for Concurrent and Distributed software design

Interaction Semantics

Dataflow (DF)

grafo onde nós são operações e arestas são filas

+

3

5

+8

Considera um fluxo contínuo de dados

Noção de ativamento de um ator

Restrição sobre o consumo e produção

Muito concorrente e ótimo para fazer um workflow

Page 15: Odog : A Framework for Concurrent and Distributed software design

Interaction Semantics

Discrete Events (DE)Baseado no processamento ordenado de eventos

um evento é um par (v, t), onde v é um valor de algum tipo e t é um timestamp

timestamp é um valor real utilizado para modelar um instante de tempo

eventos são mantidos em uma fila global, ordenados pelo timestamp

Possui um modelo global de tempo discreto

Ideal para fazer um modelo de 

ambiente de operação, ou simulação

AA

B

C

t

t

Page 16: Odog : A Framework for Concurrent and Distributed software design

Interaction Semantics

Synchronous Reactive (SR)

● Tempo dividido em uma série de instantes● Sistema deve entrar em “equilíbrio”....dois requisitos

– Valores ordenados nas saídas dos componentes

– Funções monotônicas

ausente valor estado definido

estado indefinido

Encontrar o menor ponto fixo (f(x) = x)

A

B

C

1 3

4

2

5

3

5

4

2

oo

i

d

Page 17: Odog : A Framework for Concurrent and Distributed software design

Interaction Semantics

Encontrar o menor ponto fixo (f(x) = x)

A

B

C

1 3

4

2

5

3

5

4

2

oo

i

d

A C

B

1

23

4

5

e(i) = d(i, e(i))

Modelo bom para sistemas reativos e fortemente acoplados

Page 18: Odog : A Framework for Concurrent and Distributed software design

CODE

Page 19: Odog : A Framework for Concurrent and Distributed software design

Syntax

odog.syntax.Nodes

Classes para todos os elementos da sintaxe abstrata

odog.syntax.Parse

Parser que cria um modelo a partir do arquivo .xml

Page 20: Odog : A Framework for Concurrent and Distributed software design

Syntax

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE atomicComponent PUBLIC "-//ODOGSYNTAXATOMIC//DTD//EN" ""><atomicComponent name="Producer"> <dport name="out" isInput="false" isOutput="true"> <portType> <attribute name="portType"> <attrClassification visible="true" hasData="true" static="true"/> <value type="string" valueExpr="char *"> <attrRef completeAttrName="Producer.out.portType"/> </value> </attribute> </portType> </dport> <version name="DF"> <method name="compute" language="C" codeURL="ProdutorDF.c"> </method> <method name="finish" language="C" codeURL="ProdutorDF.c"> </method> <method name="init" language="C" codeURL="ProdutorDF.c"> </method> </version></atomicComponent>

Page 21: Odog : A Framework for Concurrent and Distributed software design

Rule Check

● Abstract syntax = Acyclic Graph

● Rule = first order logic

● Allows for efficient, clean and scalable checks during design time

– Developers of the framework

– Developers of applications using the framework

PT.atomicComponent.a( EX.atomicVersion.x( a -> x) )

● Check the Odog's manual for more info

Page 22: Odog : A Framework for Concurrent and Distributed software design

Rule Check

odog.ruleChecker

Classes para construir a regra e comparar com o modelo do componente

Page 23: Odog : A Framework for Concurrent and Distributed software design

Code Generation

● Template based

odog.codegen.util

Classes para implementar um template

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE fileGenerator PUBLIC "-//ODOGFILEGENERATOR//DTD//EN" "">

<fileGenerator><text>vec = remove_dynamic_fifo(</text><argument name="arg0"/><text>, 1); *p2 = ((odog_data_pkg *)vec[0])->data; *p3 = ((odog_data_pkg *)vec[0])->length; free(vec[0]); free(vec);</text></fileGenerator>

Page 24: Odog : A Framework for Concurrent and Distributed software design

Code Generation

odog.codegen

Classes básicas para implemntação de um gerador de código para uma plataforma e semântica de interação

Page 25: Odog : A Framework for Concurrent and Distributed software design

Host Language

● Currently only C

● Methods for communication

void send(char *connection, void *data, size_t length)

int numberOfConnections(char *port)

char *nameOfConnection(char *port, int number)

void sendDelayed(char *connection, void *data, size_t length, double instant)

void sendAll(char *port, void *data, size_t length)void sendAllDelayed(char *port, void *data, size_t length, double instant)

void receive(char *connection, void **data, size_t *length)

char canReceiveAll( port , int size)

char canSend( connection , int size)

Page 26: Odog : A Framework for Concurrent and Distributed software design

Host language

● Methods for execution control

void init(void)

void finish(void)

void compute(void)

void fixpoint(void)

Page 27: Odog : A Framework for Concurrent and Distributed software design

GUI

● Simple but functional GUI

Page 28: Odog : A Framework for Concurrent and Distributed software design

GUI

odog.design

Classes para representar bibliotecas e projetos com componentes

odog.editor

A GUI central

odog.editor.*

Frames para editar os respectivos elementos de projeto

Page 29: Odog : A Framework for Concurrent and Distributed software design

DEMO TIME!

Page 30: Odog : A Framework for Concurrent and Distributed software design

Producer Consumer

● Projeto com um ator produtor e outro receptor

● 4 testes

– DF

– DE

– SR

– DE-SR● Teste na plataforma Host quanto na Multicore

Page 31: Odog : A Framework for Concurrent and Distributed software design

Susan

● Algoritmo para desenhar contornos em imagens

● Teste na plataforma OmapH2

Page 32: Odog : A Framework for Concurrent and Distributed software design

SQLi

● 0d1n : Ferramenta feita pelo Antonio “Cooler”

What this it ?

0d1n is a tool for automating customized attacks against web applications..

● https://github.com/CoolerVoid/0d1n

0d1n -h 'http://testphp.vulnweb.com/listproducts.php?cat=!' -p payloads/sqli.txt -f response2find/find.txt -o out -T 10

● Transformada em componente e acoplada com um spider. Plataforma multicore.

Page 33: Odog : A Framework for Concurrent and Distributed software design

Twitter

● Tweepy : biblioteca em python para API do twitter

● Scripts para puxar informações

● Por enquanto, python no odog somente com stubs...

Py_Initialize();

PyRun_SimpleFile(fp, "follow.py");

Py_Finalize();

close(fp);

Page 34: Odog : A Framework for Concurrent and Distributed software design

Future Work

● Plataformas distribuídas

– Clouds

– Big data● Python como outra host language