resources control graphs
play

Resources Control Graphs Jean-Yves Moyen LIPN CNRS GeoCal ICC - PowerPoint PPT Presentation

Resources Control Graphs Jean-Yves Moyen LIPN CNRS GeoCal ICC p. Motivations Programs analysis deal about uniform properties: Do all the executions terminate? Are all the executions performed within a given time/space bound ?


  1. Resources Control Graphs Jean-Yves Moyen LIPN – CNRS GeoCal – ICC – p.

  2. Motivations Programs analysis deal about uniform properties: Do all the executions terminate? Are all the executions performed within a given time/space bound ? Importance of the use of resources. Time and space are resources usually considered. Termination is usually reduced to finding a decreasing well-founded ordering, i.e. total usage of a finite resource. Only specific resources may be considered (non-overflow of a specific buffer or stack). Design a single tool for this kind of analysis. GeoCal – ICC – p.

  3. The core idea GeoCal – ICC – p.

  4. Control Flow Graphs We’re working here over counters machines. 0 : if x = 0 jmp end 1 : x − − 2 : y + + 3 : jmp 0 end end : GeoCal – ICC – p.

  5. Control Flow Graphs We’re working here over counters machines. 0 0 0 : if x = 0 jmp end x � = 0 x = 0 1 : x − − 1 1 end end 2 : y + + dec x 3 : jmp 0 2 2 end end : inc y jmp 0 3 3 GeoCal – ICC – p.

  6. Control Flow Graphs We’re working here over counters machines. 0 0 0 : if x = 0 jmp end x � = 0 x = 0 1 : x − − 1 1 end end 2 : y + + dec x 3 : jmp 0 2 2 end end : inc y jmp 0 3 3 An execution of the program � A path in the CFG. GeoCal – ICC – p.

  7. Petri nets and VASS Resource usage, i.e. values of variables, can be seen as the number of token in states of a Petri net. if x = 0 jmp end 0 : 0 0 x − − 1 : x � = 0 x = 0 2 : y + + jmp 0 3 : 1 1 end end : end end dec x 2 2 inc y jmp 0 3 3 GeoCal – ICC – p.

  8. Petri nets and VASS Resource usage, i.e. values of variables, can be seen as the number of token in states of a Petri net. if x = 0 jmp end 0 : 0 x − − 1 : x � = 0 x = 0 2 : y + + jmp 0 3 : 1 end : end end dec x 2 inc y 3 jmp 0 GeoCal – ICC – p.

  9. Petri nets and VASS Resource usage, i.e. values of variables, can be seen as the number of token in states of a Petri net. if x = 0 jmp end 0 : 0 x − − 1 : x � = 0 x = 0 2 : y + + jmp 0 3 : 1 end x : end end dec x 2 y inc y 3 jmp 0 GeoCal – ICC – p.

  10. Petri nets and VASS Values of variables can be stored in a vector thus leading to a Vectors Addition System with States (VASS). if x = 0 jmp end 0 : x − − 1 : 2 : y + + 3 : jmp 0 : end end GeoCal – ICC – p.

  11. Petri nets and VASS Values of variables can be stored in a vector thus leading to a Vectors Addition System with States (VASS). if x = 0 jmp end 0 : 0 0 x − − 1 : 2 : y + + 3 : jmp 0 1 1 end end : end end ( − 1 , 0) 2 2 (0 , +1) 3 3 GeoCal – ICC – p.

  12. Petri nets and VASS Values of variables can be stored in a vector thus leading to a Vectors Addition System with States (VASS). ( x, y ) if x = 0 jmp end 0 : 0 0 x − − 1 : 2 : y + + 3 : jmp 0 ( x, y ) 1 1 end end : end end ( x, y ) ( − 1 , 0) ( x − 1 , y ) 2 2 (0 , +1) 3 3 ( x − 1 , y + 1) GeoCal – ICC – p.

  13. Resource Systems with States GeoCal – ICC – p.

  14. Resource Systems with States A RSS is a quintuple ( G, V, V + , W, ω ) where: GeoCal – ICC – p.

  15. Resource Systems with States A RSS is a quintuple ( G, V, V + , W, ω ) where: G is a directed graph. S = { s 1 , · · · , s n } are the vertices. A = { a 1 , · · · , a m } are the edges. GeoCal – ICC – p.

  16. Resource Systems with States A RSS is a quintuple ( G, V, V + , W, ω ) where: G is a directed graph. S = { s 1 , · · · , s n } are the vertices. A = { a 1 , · · · , a m } are the edges. For each vertex s i , there is: A set of valuations V i A set of admissible valuations V + i . V = � V i , V + = � V + i . GeoCal – ICC – p.

  17. Resource Systems with States A RSS is a quintuple ( G, V, V + , W, ω ) where: G is a directed graph. S = { s 1 , · · · , s n } are the vertices. A = { a 1 , · · · , a m } are the edges. For each vertex s i , there is: A set of valuations V i A set of admissible valuations V + i . V = � V i , V + = � V + i . W i,j = F ( V i , V j ) , W = � W i,j is the set of weights. ω : A → W such that if a = ( s i , s j ) , then ω ( a ) ∈ W i,j . GeoCal – ICC – p.

  18. Configuations and walks Let G = ( S, A ) be a graph. A vertex is an element of S . A path is a sequence of vertices s 1 , · · · , s n such that there is an edge between s i and s i +1 . GeoCal – ICC – p.

  19. Configuations and walks Let G = ( S, A ) be a graph. A vertex is an element of S . A path is a sequence of vertices s 1 , · · · , s n such that there is an edge between s i and s i +1 . Let R = ( G, V, V + , W, ω ) be a RSS. A configuration is a couple ( s i , x ) with x ∈ V i . A configuration ( s i , x ) is admissible if x ∈ V + i . GeoCal – ICC – p.

  20. Configuations and walks Let G = ( S, A ) be a graph. A vertex is an element of S . A path is a sequence of vertices s 1 , · · · , s n such that there is an edge between s i and s i +1 . Let R = ( G, V, V + , W, ω ) be a RSS. A configuration is a couple ( s i , x ) with x ∈ V i . A configuration ( s i , x ) is admissible if x ∈ V + i . A walk is a sequence of configurations ( s 1 , x 1 ) , · · · , ( s n , x n ) such that: s 1 , · · · , s n is a path. If a i is the edge between s i and s i +1 , then x i +1 = ω ( a i )( x i ) . GeoCal – ICC – p.

  21. Turing Machines A TM can be represented by a RSS in the following way: Underlying graph is the automaton of the TM. Valuations (and admissible valuations) are bi-infinite strings over { 0 , 1 } . Weights perform the corresponding operations. Each execution of the TM corresponds to an (admissible) walk in the RSS and each (admissible) walk in the RSS corresponds to an execution of the TM. By Rice’s theorem, extensionnal properties of RSS are not decidable. GeoCal – ICC – p.

  22. Facts and notations Let R = ( G, V, V + , W, ω ) be a RSS. Let ( s 0 , x 0 ) , · · · , ( s n , x n ) be a walk following edges a 1 , · · · , a n . x n = ω ( a n ) ◦ · · · ◦ ω ( a 1 )( x 0 ) . Functions composition is done in reverse order. Weight functions are usually somewhat uniform. We write f � g instead of g ◦ f and x ⊛ f instead of f ( x ) . x n = x 0 ⊛ ω ( a 1 ) � · · · � ω ( a n ) . � is associative. W is the closure of � ω ( a i ) by � . GeoCal – ICC – p. 1

  23. Ordering, termination, resource awarness An ordered RSS is a RSS R = ( G, V, V + , W, ω ) together with a well partial order ≺ over V . GeoCal – ICC – p. 1

  24. Ordering, termination, resource awarness An ordered RSS is a RSS R = ( G, V, V + , W, ω ) together with a well partial order ≺ over V . R is monotonic if all functions in W are monotonic (increasing). R is positive if v ∈ V + and v ≺ v ′ implies v ′ ∈ V + . GeoCal – ICC – p. 1

  25. Ordering, termination, resource awarness An ordered RSS is a RSS R = ( G, V, V + , W, ω ) together with a well partial order ≺ over V . R is monotonic if all functions in W are monotonic (increasing). R is positive if v ∈ V + and v ≺ v ′ implies v ′ ∈ V + . R uniformely terminates if there is no infinite admissible walk. R is f -resource aware if for each admissible walk ( s 0 , x 0 ) , · · · , ( s i , x i ) , x i ≺ f ( x 0 ) ( f increasing). GeoCal – ICC – p. 1

  26. A first result R does not uniformely terminate ⇒ ∃ an admissible cycle ( s, x ) ∗ → ( s, x ′ ) such that x � x ′ . If R is monotonic and positive, the converse is true. GeoCal – ICC – p. 1

  27. A first result R does not uniformely terminate ⇒ ∃ an admissible cycle ( s, x ) ∗ → ( s, x ′ ) such that x � x ′ . If R is monotonic and positive, the converse is true. If an infinite admissible walk exists, extract from it an infinite sequence of configurations with the same vertex. Since ≺ is a well ordering, x � x ′ can be extracted from this sequence. GeoCal – ICC – p. 1

  28. A first result R does not uniformely terminate ⇒ ∃ an admissible cycle ( s, x ) ∗ → ( s, x ′ ) such that x � x ′ . If R is monotonic and positive, the converse is true. If an infinite admissible walk exists, extract from it an infinite sequence of configurations with the same vertex. Since ≺ is a well ordering, x � x ′ can be extracted from this sequence. If the cycle exists, follow it infinitely many time. Monotonicity ensure that valuations reached increase and positivity that this keeps everything admissible. GeoCal – ICC – p. 1

  29. Resource Control Graph Let p be a program. It’s Resource Control Graph (RCG) is a RSS where: The underlying graph is the Control Flow Graph. Admissible valuations approximate the state of memory. Approximations allow to restrict weighting functions to some uniform familly of functions ( e.g. λx.x + α ). GeoCal – ICC – p. 1

  30. Resource Control Graph Let p be a program. It’s Resource Control Graph (RCG) is a RSS where: The underlying graph is the Control Flow Graph. Admissible valuations approximate the state of memory. Approximations allow to restrict weighting functions to some uniform familly of functions ( e.g. λx.x + α ). To each execution of the program corresponds an admissible walk in the RCG. GeoCal – ICC – p. 1

Recommend


More recommend