Automated Software Engineering with Concurrent Class Machines
-
Upload
callie-garrett -
Category
Documents
-
view
35 -
download
0
description
Transcript of 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
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,…).
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),
Readers/Writers Problem
Resource
Monitor
Client WrCapThread
RdCapm
m
1
*
res
1 *
Class Diagram
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
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
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
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
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
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
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
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
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
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.
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
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),