
e173b8963ac3c475e345f27d34aae303.ppt
- Количество слайдов: 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
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 Class Diagram res Monitor 1 Thread * m 1 * Rd. Cap m Client Wr. Cap
Classes Monitor attributes res: Resource; -free: boolean; ar: int; +Monitor(r: Resource) +acq. Rd(): void +acq. Wr(): void Call entry point return exit point +rel. Rd(): void +rel. Wr(): void Method signature methods
Transitions Monitor res: Resource; -free: boolean; ar: int; +Monitor(r: Resource) +acq. Rd() transition (atomic) free | ar > 0 -> free : = false; ar : = ar+1 +acq. Wr() guard +rel. Rd() (blocking) +rel. Wr() method can be declared atomic assignments (parallel)
Call Hierarchy (Boxes) Rd. Cap -m: Monitor; -in. CS: boolean; +Rd. Cap(m: Monitor) local return variables +rel(): void throws Mon. Exc expression choice point return +read(): int throws Mon. Exc v: int; e: Mon. Exc (nondeterminism) v variable v in. Cs +acq(): void throws Mon. Exc ! in. CS new Mon. Exc object creation box e m. res. read() method invocation box e exception exit point
Concurrency Client extends Thread -m: Monitor +main(): void new Resource r new Monitor(r) +run(): void thread run method r: Resource; c: Client m new Client(m) c c. start thread start box
Operational Semantics Transition system A* = (S, s 0, ) Ctrl Frame Stack n 0 f 0 k 0 ni b 0 k 0 f 0 k 0 -1 … … b 01 … … … bi 1 fi 0 t 0: Thread … ti: Thread Object Pool … n’ 0 fiki biki fiki-1 f 00 Attrt 0 Ctrl Frame Stack Attrti t 0 Ctrl Frame Stack f’ 0 k 0 ni b 0 k 0 f 0 k 0 -1 … … b 01 fiki biki fiki-1 f 00 … … … bi 1 fi 0 t 0: Thread … ti: Thread Attr’t 0 Object Pool … Attrti
Method Invocation Box Client Ctrl Frame Stack -m: Monitor +run(): int r: Resource; i: int i r. read() b Resource +read(): int RResource +read(): int v v b. c f … …
Method Invocation Box (Call) Client Ctrl Frame Stack -m: Monitor +run(): int r: Resource; i: int i r. read() b. c f … … b Resource +read(): int RResource +read(): int v c fb b v f … … Ctrl Frame Stack
Method Invocation Box (Return) Client Ctrl Frame Stack -m: Monitor +run(): int r: Resource; i: int i r. read() b. r f[v/i] … b Resource +read(): int RResource +read(): int … v r fb b v f … … Ctrl Frame Stack
Environment (Interface) Objects Client Ctrl Frame Stack -m: Monitor +run(): int r: Resource; i: int i r. read() b. r f[v/i] … … b Resource +read(): int Static vars, streams… v Allow compositional modeling & reasoning: • Their body is not known and not part of • Allow any update of public objects. The latter are determined via an escape analysis.
Denotational Semantics Execution of CCM m • • • s 0 -> s 1 -> s 2 ->… -> 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 M N < < N’ M M N N’ M Sub-CCM refinement M < N = N M’ Super-CCM refinement M lfp < M’ N M’ M’ M < N Fixpoint induction < N
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),