210 likes | 219 Views
This project explores the transformation of Boolean Dataflow (BDF) models to Petri nets while preserving schedulability. The motivation is to apply scheduling techniques for Petri nets to the scheduling problem in BDF models. The proposed transformation includes handling initial tokens, synchronization, and blocking writes. The project also extends consistency to Petri nets and discusses future research directions.
E N D
A Schedulability-Preserving Transformation of BDF to Petri Nets Cong Liu EECS 290n 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. • Both have the scheduling problem • Existence of Bounded Memory Schedules for BDF is undecidable [Buck 93]. • No algorithms can guarantee to find a schedule if one exists. • Petri nets are not Turing complete [Peterson 81]. • 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? • Trace equivalence • Language containment • Simulation relation • What property to preserve during transformation? • Turing-completeness of BDF make transformation applicable to a subclass of BDF
SELECT F T SWITCH F T 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); } f g OUT
IN X>0? B C 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); }
D E Boolean Dataflow (BDF) • 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. • BDF: superset of synchronous dataflow (SDF) [Lee87] A B SWITCH T F T F SELECT F
A B T F D E T F F (A,B,b:D,!b:E,F) Schedules of Boolean Dataflow • A schedule is a finite list of guarded firings, where: • there exists a feasible cyclic firing sequence returning to initial state regardless of values of Boolean controls • Bounded length schedule • Length of cyclic firing sequences are bounded by a constant, E.g. repeat (5) times. • Bounded memory schedule • Length of cyclic firing sequences are bounded by a constant, E.g. repeat (x) times.
Scheduling Boolean Dataflow • Solving balance equation • Consistency check • Simulation to test firability • Clustering • Dynamic scheduling
a p1 b c p2 p3 e d p4 f Petri Nets • A directed graph with two kinds of nodes: place, transition • System state (marking): number of tokens in each place • Transition enabled if enough tokens in all incoming places • Firing a transition consume/produce tokens Free choice set: {b, c} T-invariants: {a, b, d, f}, {a, c, e, f}
null a p1 f a c b p2 p3 p1 e b d c p4 p2 p3 e d p4 f Scheduling Petri Nets • A schedule is a rooted tree • Finite • Nodes → reachable markings, (root → initial marking) Edges → transitions • Transitions in a FCS are fired at each node • Each node has a path to root (if add returning arc)
null a p1 f a c b A B p2 p3 p1 T F e b d c p4 D E p2 p3 T F e d F p4 (A,B,b:D,!b:E,F) f Comparing BDF and PN schedules fire A; fire B; if (B) { fire D; } else { fire E; } fire 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 • Use synchronization (blocking write) to enforce ordering
A B A B A A pF pF pT pT T F F T F T T F C pT’ pF’ pT’ pF’ C B B C C 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 Transformation • Strong synchronization enforces blocking write at Boolean control ports A T F A pT’ pF’ pT’ pF’
E E A SWITCH T F T F B C pT1 pF1 F F T SELECT pTa1 paF1 D Handling initial tokens A T F B C T F T F D pT2 pF2 pTa2 paF2
Algorithm Transform (BDF) { transform_SDF_actors; transform_BooleanGenerators; 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: • Determine exact times each actor to be fired • Transform BDF to acyclic precedence graph (APG) • Decompose Petri net to marked graph component (MGC) • Build up equivalence between APG and MGC
E A SWITCH T F B C F F T SELECT D 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. For any T-invariants, if it contains transition T of SWITCH, it also contains transition T of SELECT p1 = p2 p1 p2
E E A SWITCH T F T F B C pT1 pF1 F F T SELECT pTa1 paF1 D A T F B C T F T F D pT2 pF2 pTa2 paF2
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? • 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