automated software engineering with concurrent class machines radu grosu suny at stony brook joint...
TRANSCRIPT
![Page 1: 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](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/1.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/2.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/3.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/4.jpg)
Readers/Writers Problem
Resource
Monitor
Client WrCapThread
RdCapm
m
1
*
res
1 *
Class Diagram
![Page 5: 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](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/5.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/6.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/7.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/8.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/9.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/10.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/11.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/12.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/13.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/14.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/15.jpg)
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 Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY](https://reader035.vdocuments.site/reader035/viewer/2022072017/56649f055503460f94c1af98/html5/thumbnails/16.jpg)
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),