3 ms·
How would that work? My understanding of async is that it's a way of interacting with IO. So how would the examples you give (additional, while loops) behave
by luhn 11y ago
How would that work? My understanding of async is that it's a way of interacting with IO. So how would the examples you give (additional, while loops) behave asynchronously, since they don't involve IO? (Except for maybe memory IO..?)
- chrisseaton 11y agoAddition still takes time though doesn't it? The idea is I could start an addition operation, and then be notified in some way when it's done. I think the idea most similar to what the grandparent wants is instruction-level dataflow, where programs are DAGs, and instructions are only run when their inputs are ready, rather than when a program counter reaches them. Physical dataflow machines were built that did this in hardware.
- luhn 11y agoA program as a DAG.... Whoa. That's an interesting concept to try to wrap your mind around.
- harlowja 11y agoJust fyi, a library openstack (and myself and others) has created (in python) basically lets u program your workflow (really dataflow) as a DAG, and then the library will run it reliably (and in parallel and so-on). I'm more than willing to answer questions about how it does that if people are interested... http://docs.openstack.org/developer/taskflow/ http://docs.openstack.org/developer/taskflow/ https://pypi.python.org/pypi/taskflow https://pypi.python.org/pypi/taskflow And yes u can do things like built equation solvers to: http://docs.openstack.org/developer/taskflow/examples.html#linear-equation-solver-in-parallel http://docs.openstack.org/developer/taskflow/examples.html#l... And other neat things: http://docs.openstack.org/developer/taskflow/#examples http://docs.openstack.org/developer/taskflow/#examples
- glittershark 11y agoThat's exactly how Haskell's IO monad works (albeit a little simplified)
- tomn 11y ago> programs are DAGs, and instructions are only run when their inputs are ready, rather than when a program counter reaches them. At a low level, that's exactly what modern CPUs do. https://en.wikipedia.org/wiki/Out-of-order_execution https://en.wikipedia.org/wiki/Out-of-order_execution
- chrisseaton 11y agoRight, but only on a single core and only over a small sliding window. Real data flow machines made it explicit rather than a fragile optimisation and scaled it up.
- tomn 11y agoTrue, though with multiple functional units there is some parallelism. Just thought it was an interesting comparison.