1 / 20

Bandera Intermediate Representation (BIR)

Bandera Intermediate Representation (BIR). Raivo Piirat LAP M. Bogor Modeling Language − BIR. Used to r epresent models of concurrent object-oriented systems Guarded command language when <condition> do <command> N ative support for a variety of object - oriented language features

sheryl
Download Presentation

Bandera Intermediate Representation (BIR)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bandera Intermediate Representation (BIR) Raivo Piirat LAP M

  2. Bogor Modeling Language − BIR • Used to representmodels of concurrent object-oriented systems • Guarded command language when <condition> do <command> • Native support for a variety of object-oriented language features dynamically created objects andthreads, exceptions, methods, inheritance, etc.

  3. A BIR system: modeling 2-dining-philosophers system TwoDiningPhilosophers { boolean fork1;boolean fork2 ; activethread Philosopher1( ) { locloc0 : // take first fork when !fork1 do { fork1 := true ; } goto loc1; loc loc1: //takesecond fork when !fork2 do { fork2 := true ; } goto loc2; loc loc2 : / / put second fork do {fork2 := false ; }goto loc3; loc loc3 : // put first fork do { fork1 := false ; } goto loc0 ; } active thread Philosopher2( ) { loc loc0 : // takesecond fork when !fork2 do { fork2 := true ; } goto loc1 ; loc loc1 : // take first fork when !fork1 do { fork1 := true ; } goto loc2 ; loc loc2 : // put first fork do { fork1 := false ; } goto loc3 ; loc loc3 : // put second fork do {fork2 := false; } goto loc0 ; } }

  4. BIR Execution • A BIR execution can be viewed assequence of atomic steps or transitionsbetween system states. • State holds allinformation that is necessary to carry oncomputation starting from a particularpoint in the system's execution • State consists of values of system variables and current control location (program counter) of each thread

  5. Notation for BIR State • System State [pc1 -> 0, pc2 -> 2, fork1 -> false, fork2 -> true] pc for Philospher1 is loc0 pc for Philosopher2 is loc2 value of fork1 is ‘false’ value of fork2 is ‘true’ • sometimes we will abbreviate as… [0, 1, false, true] ...if the ordering of variable values is clearfrom the context

  6. BIR Transition Notation • The notation represents the fact that thread t has executed a transition outof location l.

  7. State Transition System • A state transition systemis a mathematical structurethat will allow us to reasonprecisely about the behaviorof simple concurrent systems. • Σ = (S,T,S0,L) …describes the behavior of a particular system S is a set of system states T is a set of transitions each transition δ is a relation between states S0 is a set of initial states L maps a state s to a set of primitive properties that are true of s.

  8. Transitions as Relations/Functions • Formally, α is a subset of S x S, i.e., α is a relation between statesgiven an input state s, α (s)yields the statesoutput by the transition. • A transition is deterministicif for every state s there is at most one state s’ such that α(s, s’). When α is non-deterministic (i.e., when α can be viewed as a function from states tostates), we write s’ = α (s). • Example: loc loc1: // take second fork when !fork2 do { fork2 := true; }goto loc2;

  9. Intra-Thread Non-determinism • Sometimes there can be more than one enabled transitionfor a particular thread loc loc0: when A do { x := x + 1 } goto loc1; when B do { y := y + 1 } goto loc2; when both A and B are true, one of thetransitionsleading out of loc0 is chosen non-deterministically

  10. Enabled/Disabled Transitions • a transition α is enabledfor a state sif thereexists a state s’such that α( s) = s’ (i.e., α isdefinedon s) • a transition α is disabledfor a state sif α isundefined on s. • Notation for enabled/diabled enabled(s) - the set of transitions enabled at s enabled(s,t) - the set of transitions from thread t that are enabledat s disabled(s), disabled(s,t) - …similar to above pc(s,t) - the value in s of the program counter for t current(s), current(s,t) - the set of all transitions (whether enabled or disabled) associated with the current programcounters of s.

  11. Examples

  12. Visualizing the possible schedules (computational tree)

  13. Computation tree for SumToN

  14. Assertion will fail when N is set to 2.

More Related