A SchedulabilityPreserving Transformation of BDF to Petri Nets
A Schedulability-Preserving Transformation of BDF to Petri Nets Cong Liu EECS 290 n Class Project December 10, 2004
Outline Motivation ¢ Scheduling Petri Nets (PN) ¢ Scheduling Boolean Dataflow (BDF) ¢ Proposing a Transformation ¢ Extension of Consistence to PN ¢ Future Research Direction ¢
Motivation ¢ Both BDF and Petri nets are concurrent models. l ¢ Existence of Bounded Memory Schedules for BDF is undecidable [Buck 93]. l ¢ No algorithms can guarantee to find a schedule if one exists. Petri nets are not Turing complete [Peterson 81]. l ¢ Both have the scheduling problem Efficient scheduling algorithms exist [Cortedella 00]. Can we apply scheduling techniques for PN to scheduling BDF?
Motivation ¢ ¢ ¢ It is known SDF is equivalent to marked graph, a subclass of Petri nets How about BDF? If we want to build up equivalence, then what kind of equivalence? l l l ¢ ¢ Trace equivalence Language containment Simulation relation What property to preserve during transformation? Turing-completeness of BDF make transformation applicable to a subclass of BDF
If-Then-Else using BDF IN >0? while (1) { read (IN, x, 1); if (x>0) y = f(x); else y = g(x); write (OUT, y, 1); } SWITCH F T f g F T SELECT OUT
If-Then-Else using PN while (1) { read (IN, x, 1); if (x>0) y = f(x); else y = g(x); write (OUT, y, 1); } IN X>0? B OUT C
Boolean Dataflow (BDF) ¢ BDF: superset of synchronous dataflow (SDF) [Lee 87] l l Consumption/production rate is a two-valued (including zero) function of the value of a Boolean token received by the control port of the actor. Control ports always transfer exactly one token per execution. A B T F D E T F F SWITCH SELECT
Schedules of Boolean Dataflow ¢ A schedule is a finite list of guarded firings, where: l ¢ Bounded length schedule l ¢ there exists a feasible cyclic firing sequence returning to initial state regardless of values of Boolean controls Length of cyclic firing sequences are bounded by a constant, E. g. repeat (5) times. Bounded memory schedule l Length of cyclic firing sequences are bounded by a constant, E. g. repeat (x) times. A B T F D E T F F (A, B, b: D, !b: E, F)
Scheduling Boolean Dataflow Solving balance equation ¢ Consistency check ¢ Simulation to test firability ¢ Clustering ¢ Dynamic scheduling ¢
Petri Nets ¢ ¢ A directed graph with two kinds of nodes: place, transition System state (marking): number of tokens in each place b Transition enabled if enough p 2 tokens in all incoming places Firing a transition d consume/produce tokens a p 1 c Free choice set: {b, c} p 3 e p 4 f T-invariants: {a, b, d, f}, {a, c, e, f}
Scheduling Petri Nets ¢ A schedule is a rooted tree l Finite l Nodes → reachable markings, (root → initial marking) Edges → transitions l l Transitions in a FCS are fired at each node Each node has a path to root (if add returning arc) a p 1 b null c p 2 a p 1 p 3 f e d p 4 c b p 3 p 2 e d p 4 f
Comparing BDF and PN schedules a A B T p 1 F D E T F F (A, B, b: D, !b: E, F) fire A; fire B; if (B) { fire D; } else { fire E; } fire F; b null c p 2 a p 1 p 3 f e d p 4 c b p 3 p 2 e d p 4 f
Challenges to transformation Petri nets do not distinguish tokens. ¢ Petri nets do not preserve order of tokens. ¢ ¢ Proposed solutions: Use different places to hold tokens with different values l Use synchronization (blocking write) to enforce ordering l
A Transformation A set of “True”/ ”False” places express controls. ¢ A set of “Acknowledge” places to synchronize the production and consumption of Boolean tokens. ¢ A p. F p. T T F B C B A A T p. T’ p. F’ B C p. F p. T T F B A F C TF p. T’ p. F’ C
A Transformation ¢ Strong synchronization enforces blocking write at Boolean control ports A T A F p. T’ p. F’
Handling initial tokens E A T E SWITCH T F F T p. T 1 A B F F p. F 1 p. Ta 1 pa. F 1 C B C T F T SELECT T p. T 2 F p. F 2 D p. Ta 2 F pa. F 2 D
Algorithm Transform (BDF) { transform_SDF_actors; transform_Boolean. Generators; transform_SWITCH; transform_SELECT; handeling_initial_tokes; }
Propositions ¢ Proposition 1 If the transformed Petri net has a bounded length schedule, the corresponding BDF has a bounded length schedule. Sketch of proof: show that Petri net contains a subset of behaviors of BDF. ¢ Proposition 2 If the BDF has a bounded length schedule, the transformed Petri net has a bounded length schedule. Sketch of proof: l Determine exact times each actor to be fired l Transform BDF to acyclic precedence graph (APG) l Decompose Petri net to marked graph component (MGC) l Build up equivalence between APG and MGC
Extension of Consistence to PN ¢ The restrictions on the values of symbolic variables of a BDF are transformed into the dependence relation of corresponding transitions of the transformed Petri net. E A SWITCH T F p 1 B F C p 2 F T SELECT D p 1 = p 2 For any T-invariants, if it contains transition T of SWITCH, it also contains transition T of SELECT
E A T E SWITCH T F F T p. T 1 A B F F p. F 1 p. Ta 1 pa. F 1 C B C T F T SELECT T p. T 2 F p. F 2 D p. Ta 2 F pa. F 2 D
Future Research Direction ¢ ¢ Does the two propositions also holds for bounded memory schedule? Can generalize the notion of schedule by assuming some kind of fairness? l ¢ ¢ ¢ Assuming program will always exit iterations Transform a Petri net to a BDF? Other equivalence alternatives? More exploration on schedulability and consistence notion for the transformation
- Slides: 21