Automated Software Engineering with Concurrent Class Machines

16
Automated Software Engineering with Concurrent Class Machines Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY at Stony Brook

description

Automated Software Engineering with Concurrent Class Machines. Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY at Stony Brook. Motivation (ASE). Automated OO software development method: OO language for req.specification/modeling/implem, - PowerPoint PPT Presentation

Transcript of Automated Software Engineering with Concurrent Class Machines

Page 1: Automated Software Engineering with Concurrent Class Machines

Automated Software Engineering with Concurrent Class

MachinesRadu Grosu

SUNY at Stony Brook

joint work with

Y. Liu, S. Smolka, S.Stoller, J. Yan

SUNY at Stony Brook

Page 2: Automated Software Engineering with Concurrent Class Machines

Motivation (ASE) Automated OO software development method:

• OO language for req.specification/modeling/implem,

• transition semantics capturing OO constructs,

• trace semantics supporting compositional refinement,

• analysis exploiting OO structure,

• generation of optimized (and monitored) code.

Close the gap between:

• object oriented methods (UML,OMT,…),

• formal methods (Model Checking, Static Analysis,…).

Page 3: Automated Software Engineering with Concurrent Class Machines

Concurrent Class Machines (CCM) 1. Modeling language for concurrent OO

systems• classes, inheritance, objects, object

creation• methods, exceptions, multithreading,• abstract collection types,

nondeterminism.2. Observational trace semantics • class machine refinement,• modular reasoning.

3. Code generation and analysis• prototype code generation.

• exploits the hierarchy information (in progress),

Page 4: Automated Software Engineering with Concurrent Class Machines

Readers/Writers Problem

Resource

Monitor

Client WrCapThread

RdCapm

m

1

*

res

1 *

Class Diagram

Page 5: Automated Software Engineering with Concurrent Class Machines

Classes

+Monitor(r:Resource)

+acqRd(): void

res: Resource; -free: boolean; ar: int;

+acqWr(): void

+relRd(): void

+relWr(): void

attributes

Call entry point

Method signature methods

return exit point

Monitor

Page 6: Automated Software Engineering with Concurrent Class Machines

Transitions

+Monitor(r:Resource)

+acqRd() free | ar > 0 -> free := false; ar := ar+1

res: Resource; -free: boolean; ar: int;

+acqWr()

+relRd()

+relWr()

transition (atomic)

assignments(parallel)

guard(blocking)

Monitor

method can bedeclared atomic

Page 7: Automated Software Engineering with Concurrent Class Machines

Call Hierarchy (Boxes)

+RdCap(m:Monitor)

-m: Monitor; -inCS: boolean;

+acq():void throws MonExc

+rel():void throws MonExc

new MonExc! inCS e

+read():int throws MonExc v: int; e:MonExc

inCs m.res.read()v

e

v

choice point(nondeterminism)

objectcreation box

return variable

methodinvocation box

return expression

exceptionexit point

local variables

RdCap

Page 8: Automated Software Engineering with Concurrent Class Machines

Concurrency

+main(): void r: Resource; c: Client

-m: Monitor

+run(): void

Client extends Thread

new Resourcer

new Monitor(r)m

new Client(m)

c.start

new Client(m)

c.start

c

threadstart box

threadrun method

c

Page 9: Automated Software Engineering with Concurrent Class Machines

Operational Semantics

Transition system A* = (S, s0, )

b0k0

b01

n0

f0k0-1

f00

f0k0

Ctrl Stack

Frame

Stack

t0:Thread

Attrt0

Object Pool

biki

bi1

ni

fiki-1

fi0

fiki

Ctrl Stack

Frame

Stack

ti:Thread

Attrti

b0k0

b01

n’0

f0k0-1

f00

f’0k0

Ctrl Stack

Frame

Stack

t0:Thread

Attr’t0

Object Pool

biki

bi1

ni

fiki-1

fi0

fiki

Ctrl Stack

Frame

Stack

ti:Thread

Attrti

t0

Page 10: Automated Software Engineering with Concurrent Class Machines

Method Invocation Box

+run(): int r: Resource; i: int

-m: Monitor

Client

r.read()i

+read(): int

Resource

+read(): int

RResource

v

v

b

b.c

f

Ctrl Stack

Frame

Stack

Page 11: Automated Software Engineering with Concurrent Class Machines

Method Invocation Box (Call)

+run(): int r: Resource; i: int

-m: Monitor

Client

r.read()i

+read(): int

Resource

+read(): int

RResource

v

v

b

b.c

f

Ctrl Stack

Frame

Stack

b

f

Ctrl Stack

Frame

Stack

c fb

Page 12: Automated Software Engineering with Concurrent Class Machines

Method Invocation Box (Return)

+run(): int r: Resource; i: int

-m: Monitor

Client

r.read()i

+read(): int

Resource

+read(): int

RResource

v

v

b

b.r

f[v/i]

Ctrl Stack

Frame

Stack

b

f

Ctrl Stack

Frame

Stack

r fb

Page 13: Automated Software Engineering with Concurrent Class Machines

Environment (Interface) Objects

b.r

f[v/i]

Ctrl Stack

Frame

Stack

• Their body is not known and not part of

• Allow any update of public objects. The latter are determined via an escape analysis.

Allow compositional modeling & reasoning:

Static vars, streams…

+run(): int r: Resource; i: int

-m: Monitor

Client

r.read()i

+read(): int

Resourcev

b

Page 14: Automated Software Engineering with Concurrent Class Machines

Denotational Semantics

Execution of CCM m

• s0-> s1-> s2->… -> sn

• si-> si+1 is a CCM transition in or

• si-> si+1 is an environment transition.

Set of Traces Lm of m

• Projection of executions on global variables.

• Object escape analysis is necessary.

Refinement m < n

• Inclusion of the sets of traces Lm Ln

• Compositional w.r.t. beh/arch hierarchies.

Page 15: Automated Software Engineering with Concurrent Class Machines

Modular Reasoning

N N’<

NM

N’M<

Sub-CCM refinement

NM < N

M’

Super-CCM refinement

M M’<N

M’

N N<

M < N

M’M =

lfp

Fixpoint induction

M

Page 16: Automated Software Engineering with Concurrent Class Machines

Wrap Up 1. Modeling language for concurrent OO

systems• classes, inheritance, objects, object

creation• methods, exceptions, multithreading,• abstract collection types,

nondeterminism.2. Observational trace semantics • class machine refinement,• modular reasoning.

3. Code generation and analysis• prototype code generation.

• exploits the hierarchy information (in progress),