home

kskb.dev/data · documents with their text · this document in the catalog

Papers

repository prose file · license Apache-2.0 · 6449 characters · the original · source smithsamuelm-papers-master

HIO Hierarchical Asynchronous Coroutines & I/O Samuel M. Smith Ph.D. sam@samuelsmith.org

What is Asynchronous Processing? Cooperative logical concurrency within a single process/thread plus nonblocking 10. Core Core Core Core Process Process Process Process coroutine coroutine coroutine coroutine coroutine Coroutine coroutine coroutine coroutine coroutine coroutine coroutine Process Process Process Process coroutine coroutine coroutine coroutine coroutine coroutine coroutine coroutine coroutine coroutine coroutine coroutine Advantages: Performant, 1 process per corefhyperthread, minimizes context switch overhead usually >15% Simple, no resources contentions, mutexes, locks, semaphores, everything is atomic wrt interruptions Scalable, granularity matches logical concurrency not arbitrary host/process boundaries

Asynchronous Optimized Computation Coroutines are the fundamental units of logically concurrent computation Hast UM Core Core Core Core Minimizes context switch overhead

Asynchronous Processing Approaches

Greenlets, Micro-threads, gevent, stackless python

Emulates conventional multi-thread/process model, join calculus, sleepy, continuous logic flow, Event Loop Callbacks, Twisted, Node.js

Medusa/Reactor pattern, callback hell, discontinuous logic flow Deferred, Python 3.5 asyncio futures, promises

Thread pool like scheduler, discontinuous logic flow Yielded Delegated, generators/coroutines, Python 3.5 asyncio coroutines

Yielding scheduler, delegating coroutines, yieldy, continuous logic flow Nested hybrid coroutines, Ioflo

Nested contextual yielding/delegating schedulers, continuous logic flow

Synchronized Async Callback | Callback T Sboine Egharal Schedter o Ephemeral Sate Partan Routne Process Evnts and (rctd o kg — T Yield o Calbacks St Cal H— | Ram - “siboune Ustof Calbadis —— o num Ephemeral — Persint (rictdo et S

Coroutine Hierarchical Coroutine e 4 = A — B e E— = —

: T - l - Uttt . s . .

Hierarchical Heterarchical Complex Hierarchical Heterarchical Syne Syme. —— s e S *‘ch = Aayre e Ao s Spe - [ mme | o [ | sape e [ [ tome e [ o] oo e sne

FLOW BASED PROGRAMMING (s o—{ o ™ o] ]

L Bw — ] ] (Foamees | oo ]

g s S ) P ™

0 /0 N Wl N U (e Lo T J o [ [ T J e o o T e [ [ T Hm

What is Flow-Based Programming (FBP) A behavior transforms its input(s) into its output(s) Black Box oo e i Parameters Inputs may also be parameters that modify the transformation A behavior transforms ifs inputs governed by its parameters into its outputs

What is Flow-Based Programming (FBP) Outputs may be fed back as state to modify the transformation State l—— Delay Parameters A behavior transforms its inputs and past outputs as governed by its parameters into its outputs

What is Flow-Based Programming (FBP) e o )| 7 o} Feane Behaviors can be reconnected endlessly in different networks without any internal changes 7

FBP applications (programs) are networks of asynchronous behaviors which exchange data across externally defined connections

What is Flow-Based Programming (FBP) ; ; * Programming is the declarative composition of networks of behaviors * FBP = Data Flow Oriented + Component Oriented * FBP = FP-ish + OOP-ish

FBP Variant with DataStore Substrate | | ) From this [ | | [ o ] To this il T Sy S s o wh Pame p - e T D /0 N Wl B U WWWWWWWWWWWWW [ * Adds configurability, observability, traceability, replayability

Meta Architecture Patterns B [T 7] e ST AR VAN e A mmmmmm (=) (=) =] [ [ [ — [— = == = = = [— [— [e—

Dependency Inversion Principle oepndneyIsrsion il i 1996 Bad Software Design: Software that fulfills its requirements but exhibits any or all of: Rigidity: Hard fo change because each change affects other parts of the system. Fragility: Making a change causes other parts of the system to break. Immobility: Hard to disentangle in order to reuse in another application. DIP: HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS. ABSTRACTIONS SHOULD NOT DEPEND UPON DETAILS. DETAILS SHOULD DEPEND UPON ABSTRACTIONS. Its all about dependency management, duh !t

Dependency Inversion Principle Transcendence

Bad Software Design: Software that fulfills its requirements but exhibits any or all of:

Rigidity: Hard fo change because each change affects other parts of the system.

Fragility: Making a change causes other parts of the system to break.

Immobility: Hard fo disentangle in order to reuse in another application. Flow-Based Programming transcends the DIP thusly:

THERE ARE NO MODULES, JUST COMPONENTS

THERE ARE NO ABSTRACTIONS OR DETAILS JUST DATA

COMPONENTS DEPEND ON DATA, NOT OTHER COMPONENTS

One Dependency: DATA o s i IS pams 5 Ol e s . A S /A S S AN . (oo [om [ o Lo o oo [ [ oo ] Data Store Substrate

Host PUNM - Process - — Process low - = Wi w | (W ) o 3 Fow su | N o )] s Sack iow Stk o )] o o o — ) e Y A\ AR\ . /6 N\ gam\iuzsl il a:aViaca\Nas() s SR IO D TN D e Enables coroutine-to-coroutine communication both intra-process, inter-process and inter-host

Many-to-many Many-to-many-to-many T N Node / ~ - “Hon L { / J(Fow) (Fow) [N ode |, —[ Node |, / 4 ™ I/ o o \ | / AN " / = N Node ] e 4 Node | N JNode ot - e N . v & ST N ~ O /T EE —En /A e ‘ A i ) ] Node \ / [N N | od ) fot Ly \ NN S/ - ’ e o = Host [ Host [~ Logically concurrent flows of execution Performance and Reliability CO"CU'TE_"{ data flows Service flows

Tuple: (datashare name, UXD name, UDP name, channel name) JSON: { "route": { "sre": [“"peter.piper.picked", "pepper", "peck"', "garden"], "dst": ["suzy.sand.sell”, "shell”, "shore", "sea"] } "tag": "commerce.hot", "stamp”: "20170125T13:45:62.340123UTC", "data": { “quantity”: 5, “price”: 1.50 } ¥

Hierarchical State W, U o - nV s st e Ton He & . Hi ® "‘ OO0 OO

Transition = Change in Framing Context go foobar if elapsed >= goal / "\ Hierarchical State Machine Tree ® €0 DR ) B ) N €5 LO0 OOO FloScript

Dichotomous Priorities oScript FloScri

Transitions Hietarcical St Machine Tree

Change Context, Propriety

Priorty i Top-Down ® @

) ) ) O OO

Actions

Determine Contextual Behavior, Specificity

Priority is Bottom-Up

Contexts: Frame of Reference “Framing” Action Execution “Actioning” ' house ) " frame \ | framer | (" enter ) | frame | set r set frame " recur do (Y do ] . B frame ( . . exit ‘ stop \

Reliable Services Envelope High Level Frames - Programmed by Experts Failure Checks Failure Handling Common Generic e Mission Specific Programmed by Non-Experts

SmithSamuelM / Papers-master, https://github.com/SmithSamuelM/Papers/blob/master/presentations/Hio.web.pdf. Licensed under the Apache License 2.0; the license and any notices are in the repository. Found through KERISSE. The abstract, the level and the labels on the catalog entry are the KERISuite Knowledge Base's own, CC BY 4.0.

Powered by Datasette · Queries took 2.419ms