OOD Design of Processes 2 Server Patterns ITV

  • Slides: 13
Download presentation
OOD Design of Processes 2 Server Patterns ITV Modelbased Analysis and Design of Embedded

OOD Design of Processes 2 Server Patterns ITV Modelbased Analysis and Design of Embedded Software Anders P. Ravn & Arne Skou Aalborg University February 2011

Simple Generic Architecture «component» Interface «component» User. Interface «component» Subsystem. Interface «component» Function «component»

Simple Generic Architecture «component» Interface «component» User. Interface «component» Subsystem. Interface «component» Function «component» Model «component» Platform «component» OS . . . «component» File. System OAD p. 196

The Task to Solve Assume: Design is already mapped to «component» MMMMM «component» Sequential

The Task to Solve Assume: Design is already mapped to «component» MMMMM «component» Sequential Programs (Classes) QQQQQ «component» Interface «component» User. Interface Provide: Architecture mapped to Concurrent Programs on a Platform «component» System. Interface «component» Function «component» Model «component» Platform «component» OS «component» File. System

Platform Characteristics Processes Synchronization Example one threads none shared objects Ordinary c++, c tasks

Platform Characteristics Processes Synchronization Example one threads none shared objects Ordinary c++, c tasks asynch. message Posix, RTOS Java, CORBA, SYMBION?

 «component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model Concurrent

«component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model Concurrent Access «component» Platform «component» OS «component» File. System «synchronized» Wrapper «interface» Application . . . read(Key) : Read. Data update(Update. Data) compute(Mode) : Result attach(Signal. Handler) + concurrent access implements read(Key k) : Read. Data update(Updat. Datae u) compute(Mode m) : Result attach(Signal. Handler sh)

Implementation (Java) «synchronized» Wrapper. . . update(Update u) synchronized class Wrapper {. . .

Implementation (Java) «synchronized» Wrapper. . . update(Update u) synchronized class Wrapper {. . . public void update(Update u). . . } }; class Wrapper {. . . public synchronized void update(Update u). . . } }; class Wrapper {. . . public void update(Update u). . . synchronized{. . . } } };

 «component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component»

«component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component» Platform «component» OS Server Pattern: Interface Component «component» File. System «interface» Application «synchronized» Server. Port Server . . . read(Key) : Read. Data update(Update. Data) compute(Mode) : Result attach(Signal. Handler) + concurrent access read(Key k) : Read. Data update(Updat. Datae u) compute(Mode m) : Result attach(Signal. Handler sh) IFunction from Function

Server Behaviour wait Server op 1 op 2 complete op 3

Server Behaviour wait Server op 1 op 2 complete op 3

 «component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component»

«component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component» Platform «component» OS Server Pattern: Function Component «component» File. System «interface» IFunction «synchronized» FServer. Port. . . read(Key) : Read. Data update(Update. Data) compute(Mode) : Result attach(Signal. Handler) read(Key k) : Read. Data update(Update. Data u) compute(Mode m) : Result attach(Signalhandler sh) FServer IModel from Model

 «component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component»

«component» Interface «component» User. Interface «component» System. Interface «component» Function «component» Model «component» Platform «component» OS And so on for a Model Server «component» File. System . . .

Server Call Pattern - update hp: Server. Port h: Server p: FServen. Port wait(op)

Server Call Pattern - update hp: Server. Port h: Server p: FServen. Port wait(op) f: FServer m: Model wait(op) update(u) wait(op) read(k) - more code - complex code + short response times + concurrency cf. OAD p. 255 -259 put(d)

Server Call Pattern - read hp: Server. Port h: Server fp: FServer. Port wait(op)

Server Call Pattern - read hp: Server. Port h: Server fp: FServer. Port wait(op) f: FServer m: Model wait(op) read(k) return(d) wait(op) cf. OAD p. 255 -259 return(d) - more code - complex code - long response times ? RMI / RPC

Exercises 1. Adapt your System (Model Component) to be a Server. 2. How many

Exercises 1. Adapt your System (Model Component) to be a Server. 2. How many Client processes would you support concurrently?