The slides contin revisited mterils from: Peter Mrwedel, TU Dortmund Lothr Thiele, ETH Zurich Frnk Vhid, University of liforni, Riverside Dtflow Lnguge Model Drsticlly different wy of looking t computtion: Impertive lnguge style: progrm counter is king Dtflow lnguge: movement of dt is the priority Scheduling responsiility of the system, not the progrmmer Processes communicting through FIFO uffers synchronous messge-pssing DtFlow Models 2 Dtflow Lnguges sic chrcteristic: Every process runs simultneously Processes cn e descried with impertive code Processes cn only communicte through uffers Sequence of red gurnteed to e the sme s the sequence of written pproprite for pplictions tht del with strems of dt: Fundmentlly concurrent: mps esily to prllel hrdwre Perfect fit for lock-digrm specifictions (control systems, signl processing) Mtches well current nd future trend towrds multimedi pplictions Representtion: Host Lnguge (process description), e.g.,, Jv,.... oordintion Lnguge (network description), usully home mde, e.g. XML. pplictions of Dtflow Not good fit for, sy, word processor Good for signl-processing pplictions nything tht dels with continuous strem of dt uffers typiclly used for signl processing pplictions nywy ecomes esy to prllelize nd to mp on prllel hrdwre Perfect fit for lock-digrm specifictions tht re common in electricl engineering ircuit digrms Liner/nonliner control systems Signl processing Processes re locks, connections re uffers 3 4 Khn process networks Khn Process () Proposed y Khn in 974 s generl-purpose scheme for prllel progrmming Executle tsk grphs ommuniction vi infinitely lrge FIFOs Lnguge ugmented with send() nd wit() opertions tht write nd red from chnnels red: destructive nd locking reding n empty chnnel locks until dt is ville write: non-locking Lid the theoreticl foundtion for dtflow Unique ttriute: deterministic 5 6
Khn Process (2) Khn Process (3) 7 8 Khn Process Network Proof of Determinism ecuse process cn t check the contents of uffers, only red from them, ech process only sees sequence of dt vlues coming in on uffers ehvior of process: ompute red compute write red compute Vlues written only depend on progrm stte omputtion only depends on progrm stte Reds lwys return sequence of dt vlues, nothing more nother wy to see it: If I m process, I m only ffected y the sequence of on my inputs I cn t tell whether they rrive erly, lte, or in wht order I will ehve the sme in ny cse Thus, the sequence of I put on my outputs is the sme regrdless of the timing of the on my inputs 9 0 dding Non-determinism Scheduling Khn Networks () hllenge is running processes without ccumulting 2 2
Scheduling Khn Networks (2) hllenge is running processes without ccumulting Demnd-driven Scheduling? pprent solution: only run process whose outputs re eing ctively solicited However... 3 lwys emit Only consumes from Tokens will ccumulte here 4 lwys produce D lwys consume Other Difficult Systems Tom Prks lgorithm Not ll systems cn e scheduled without token ccumultion Produces two s for every lterntes etween receiving one nd one 5 6 From Infinite to Finite uffer Size Dedlock Exmple 7 8 3
Exmple: Finite Size uffers in KPN Prks lgorithm in ction () 9 20 Prks lgorithm in ction (2) Prks lgorithm in ction Strt with uffers of size emits the first token emits the first token onsumes: 3 from token from lwys emit 2 22 Evlution of Khn Process Networks Synchronous Dtflow (SDF) Unit-rte ( in, out); Upsmplers ( in, n out); Downsmplers (n in, out) 23 24 4
synchronous messge pssing: Synchronous dt flow (SDF) synchronous messge pssing= tsks do not hve to wit until output is ccepted. Synchronous dt flow = ll re consumed t the sme time. Exmple SDF System SDF system my strt with in its uffers These ehve like delys (signl-processing) Delys re sometimes necessry to void dedlock E.g.: FIR Filter (ll single-rte) One-cycle dely SDF model llows sttic scheduling of token production nd consumption. In the generl cse, uffers my e needed t edges. 25 26 SDF: Fixed Production/onsumption Rtes SDF Scheduling lnce equtions (one for ech chnnel): Schedulle stticlly Decidle: uffer memory requirements dedlock numer of consumed numer of firings per itertion numer of produced fire { produce N } N chnnel M fire { consume M } 27 28 lncing Equtions Solving the lncing Eqution 29 30 5
Determine Periodic Schedule Other Exmples n Inconsistent System No wy to execute it without n unounded ccumultion of Only consistent solution is do nothing c = 0 2 = 0 c 3 c = 0 2 3 3 2c = 0 n Under-constrined System Two or more unconnected pieces Reltive rtes etween pieces undefined c 3 2 d = 0 3c 2d = 0 3 32 onsistent Rtes Not Enough consistent system with no schedule Rtes do not void dedlock SDF Scheduling Fundmentl SDF Scheduling Theorem: Solution here: dd dely on one of the rcs If rtes cn e estlished, ny scheduling lgorithm tht voids uffer underflow will produce correct schedule if it exists Underflow no process fired unless ll it consumes re ville 33 34 Summry of Dtflow Processes communicting exclusively through FIFOs Khn process networks locking red, nonlocking write Deterministic Hrd to schedule Prks lgorithm requires dedlock detection, dynmic uffer-size djustment Synchronous Dtflow (SDF) Firing rules: Fixed token consumption/production n e scheduled stticlly Solve lnce equtions to estlish rtes ny correct simultion will produce schedule if one exists 35 6