610 likes | 724 Views
Traversal techniques for concurrent systems. Marc Solé & Enric Pastor Departament of Computer Architecture UPC msole@ac.upc.es. Introduction. General objective: checking of safety properties in concurrent systems. Accomplished through Reachability Analisys.
E N D
Traversal techniques for concurrent systems Marc Solé & Enric Pastor Departament of Computer Architecture UPC msole@ac.upc.es
Introduction • General objective: checking of safety properties in concurrent systems. • Accomplished through Reachability Analisys. • Lot of work done for synchronous systems, but not for concurrent ones. In this work: traversal methods for concurrent systems.
s0 a b s0 s1 s2 {a,b} b a s3 s3 Concurrent systems particularities • Transition relations (TR) partitioned in smaller independent parts (events). • Each event is “fired” producing new states. Synchronous Concurrent
Traditional Approach • Breadth First Search (BFS) does not take advantage of these particularities. • Our proposal: schedule the application of the events in a hybrid approach (BFS/DFS).
Overview • Hypothesis • Speeding State Generation • Causality Detection • Four traversal methods • Token traverse • Weighed token traverse • Dynamic event-clustered traverse • TR cluster-closure traverse • Results & Conclusions
Hypothesis • “The faster, the better”. • Intuition: • if you need less iterations to complete the process, then the probabilities of encountering an intermediate “big” BDD diminish. • Obviously not true in all cases.
s0 s0 Speeding state generation • Great results with a very simple technique: chaining. BFS BFS with chaining s0 s0 a b a b s1 s2 s1 s2 b a b a s3 s3
Speeding state generation • Great results with a very simple technique: chaining. BFS BFS with chaining s0 s0 a b a b s1 s2 s1 s1 s2 b a b a s3 s3
Speeding state generation • Great results with a very simple technique: chaining. BFS BFS with chaining s0 s0 a b a b s1 s2 s1 s2 b a b a s3 s3
Maximizing the chaining • The order of event firing has a significant impact on the performance.
s0 b a s1 s2 b a c b s3 s4 s5 e d c e d s6 s7 s8 a b e b f f d s9 s10 s11 a g s12
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s1 s1 s2 s2 s2 b b b a a a c c c b b b s3 s3 s3 s4 s4 s4 s5 s5 s5 e e e d d d c c c e e e d d d s6 s6 s6 s7 s7 s7 s8 s8 s8 a a a b b b e e e b b b f f f f f f d d d s9 s9 s9 s10 s10 s10 s11 s11 s11 a a a g g g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
BFS BFS with chaining BFS with chaining s0 s0 s0 b b b a a a s1 s2 s1 s2 s1 s2 b a b a b a c c c b b b s3 s4 s5 s3 s4 s5 s3 s4 s5 e d e d e d c c c e e e d d d s6 s7 s8 s6 s7 s8 s6 s7 s8 a b a b a b e e e b f b f b f f d f d f d s9 s10 s11 s9 s10 s11 s9 s10 s11 a g a g a g s12 s12 s12 {a,b,c,d,e,f,g} {a,b,c,d,e,f,g} {e,a,g,c,b,f,d}
Maximizing the chaining • Information to obtain a good scheduling Causality analisys between events. • Main idea: If I have fired event X, which events are fireable now.
Notation & Definitions • The set of states in which an event is “fireable” is called Firing Function (FF). • In fact, characteristic function of the set. • Example: • FF(a) a b s0 s1 s2 b a c b s3 s4 s5 e d c e d s6 s7 s8 a b e b f f d s9 s10 s11 a g s12
Causality • Causality between TR a and TR b exists if: • You can fire a, but not b. • You fire a. • Now you can fire b. FF(a) FF(b)
Causality • Causality between TR a and TR b exists if: • You can fire a, but not b. • You fire a. • Now you can fire b. FF(a)·!FF(b)
Causality • Causality between TR a and TR b exists if: • You can fire a, but not b. • You fire a. • Now you can fire b. To a a a FF(a)·!FF(b) To = Firing a on FF(a)*!FF(b)
If this set exists [To · FF(b) ] then event bpotentially becomes fireable after event a Causality • Causality between TR a and TR b exists if: • You can fire a, but not b. • You fire a. • Now you can fire b. To FF(b) FF(a)·!FF(b)
Causality • Checking the causality for each pair of events, we can determine the causality relations between all the events in the system. • This information can be stored in different ways (i.e. matix). • For clarity we use a Petri-Net like model to represent these relations.
Petri Nets • Structure to represent relationships (synchronicity/concurrency) between components. • Three components: • Places: potential state. • Transitions: dynamic behaviour. • Tokens: present state.
Causality s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a s7
Token traverse • Put one initial token in all fireable events. • Fire the event with highest number of tokens. • If firing does not generate any new state, then the token is “absorbed”. • When all the tokens have been absorbed, compute the new states generated by this iteration. • If no new, fixpoint reached, else restart.
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a s7
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a Same number of tokens in a and b : Chose at random which to fire s7
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a Same number of tokens in b and c : Chose at random which to fire s7
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 Worst case: c is fired No new state produced, token absorbed b a s7
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a s7
Token traverse s0 • Example: b a s1 s2 a b b a s3 c s4 a b c s5 s6 b a s7
Problems with Token Traverse • Ineffective firings. As in the case of event c in the previous example. s0 a b b a s1 s2 b a s3 c c
Problems with Token Traverse • To solve this problem and produce a better scheduling we can try to relate: • number of tokens in one place • number of states in which this event is fireable.
Weighed Token Traverse • Every time an event is fired, for each successor, we add a number of tokens equal to the number of states in which this successor is fireable. s0 a b b a s1 s2 b a s3 c c
Weighed Token Traverse • In the former example, token from place a is now actually absorbed, as state s1 FF(c). s0 a b b a s1 s2 b a s3 c c
Weighed Token Traverse • This solves ineffective firing problem, but increases BDD operations. For each firing we must perform k AND operations, being k the number of successors of an event. • Fortunately, in our benchmarks k is usually small (<4).
Weighed Token Traverse • However this method does not consider the fireable states produced by concurrent events. s0 a b b a s1 s2 b a s3 2 states but only 1 token c c
Best fireable event? • Both previous methods try to find out which is the best fireable event at every moment. • A possible heuristic: fire the event that will produce more states. • Events are usually bijective functions, so the problem is equivalent to find out which event has more states in which it is fireable.