220 likes | 330 Views
Kahn’s Principle and the Semantics of Discrete Event Systems. Xiaojun Liu EE290N Class Project December 10, 2004. Kahn Process Networks. An elegant model of computation for deterministic concurrent processes.
E N D
Kahn’s Principle and the Semantics of Discrete Event Systems Xiaojun Liu EE290N Class Project December 10, 2004
Kahn Process Networks • An elegant model of computation for deterministic concurrent processes. • Processes communicate streams of data asynchronously through unbounded FIFO channels. • A denotational semantics based on complete partial orders (CPOs) and Scott continuous functions.
Kahn’s Principle Can we extend this to timed systems? • The input-output function of any network is denoted by the least fixed point solution of the network’s recursion equations. z (y, z) = f(x) F(f)(x) = (p(x, 2(f(x))), q(1(f(x)))) f = fix(F) x p q y Robert Yates and Guang Gao, “A Kahn Principle for Networks of Nonmonotonic Real-Time Processes” http://www.sable.mcgill.ca/~hendren/ftp/acaps/memo60.ps.gz
Previous Work: Yates & Gao • Timed stream: a sequence of time-stamped tokens. • The time stamps are strictly increasing and separated by a minimum time interval 0. • Processes are -causal.
Previous Work, Continued • The principle novelty of the new functional (F) … is that it cuts off all outputs as soon as the earliest new output token appears. • The new functional lets the network “run” at each step only until the earliest new output token appears.
Highlights of Approach • A direct extension of KPN to DE systems. • More general than the previous work outlined earlier. • Useful guidance to develop operational semantics and simulator.
Prefix Order − Definition • Let T, a poset, be the set of all tags. Let L(T) be the set of lower sets of T. • A signal is a function from a lower set LL(T)to some value set V, signal: L V • A signal s1: L1 V is a prefix of s2: L2 V, denoted s1s2, if and only if L1 L2, and s1(t) = s2(t), tL1 • Let S(T, V) be the set of all signals from lower sets of T to V.
Prefix Order − Examples • Given any set A, treated as a poset with the discrete order, S(A, B) is the set of all partial functions from A to B. • Let T = [0, ), and V = V {}, where represents the absence of value, S(T, V) is the set of DE signals.
Prefix Order − Properties • For any poset T of tags and set V of values, S(T, V) with the prefix order is • a poset • a CPO • a complete lower semilattice (i.e. any subset of signals have a GLB) • For any network of processes that are Scott continuous functions from input to output, Kahn’s principle applies.
Discrete Event Signals • The set of DE signals, S([0, ), V {}) is a CPO. • Examples: clock: 0 1 2 3 … … zeno: 0 ½ 1 2 3 … … r-zeno: 0 ½ 1 2 3 …
Discrete Event Processes s1: L1 V add s: L V s2: L2 V L = L1 L2 s(t) = s1(t) +s2(t), tL delay by 1 s1: L1 V s2: L2 V L2 = L1{1} [0, 1) s2(t) = s1(t 1), when t 1 and , when t [0, 1)
Biased Merge or “Default” s1: L1 V biased merge s: L V s2: L2 V Let p = sup L2. If pL2, L = L1 L2 {q | q p and t[p, q], s1(t)V } and if pL2, L = L1 L2 {q | q p and t(p, q], s1(t)V } s(t) = s1(t), when s1(t)V s2(t), otherwise, tL
0 ½ 1 … … … … … … … … 0 ½ 1 2 3 … 0 ½ 1 2 3 … 0 ½ 1 … 0 ½ 1 2 0 ½ 1 2 A Discrete Event System delay by 1 biased merge zeno … 0 ½ 1 2 3 …
YADES lookahead by 1 biased merge r-zeno … 0 ½ 1 2 3 …
Continuity and Causality • A process may be continuous but not causal, e.g. “lookahead by 1”. • A process may be causal but not continuous, e.g. one that produces an output event after counting an infinite number of input events.
Discrete Signals • A DE signal s: L V is discrete if • s-1(V) is order-isomorphic with a lower set of N and • s-1(V) is a finite set, or L = [0, sup s-1(V)). • Let D([0, ), V {}) be the set of discrete signals. With the prefix order, it is a poset, CPO, and a complete lower semilattice.
clock: 0 1 … … 0 0 ½ ½ 1 1 A Caveat biased merge ? zeno:
Operational Semantics • Represent signals as timed streams • Processes map input timed streams to output timed streams • An alternative development of Chandy and Misra’s distributed DE simulation
Representing Discrete Signals as Timed Streams • Only “present” events? (0.0, 1) many-to-one prefix not a prefix (0.0, 1), (1.0, 1)
Null Events (0.0, 1), (1.0, ) (0.0, 1), (2.0, ) one-to-many (0.0, 1), (1.0, ), (2.0, ) (0.0, 1), (1.0, 1), (2.0, )
Simultaneous Events • Extend the tag set to [0, ) N, with the lexicographical order. • All developments so far can be generalized. • Any continuous/causal DE process at a time t can be treated as a Scott continuous function from input sequences to output sequences. • A “snapshot” of a DE system at a time t is a KPN.
Current Status • Substantial progress on theoretical development • Developing a plan for implementation • Introduce “end-of-stream” marker in KPN • Change event queue to contain sequences of events with the same time stamp and receiver • Key criterion for improvement: more efficient simulation due to less traffic into/out of the event queue