Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Eventlet (Linden Labs) actually owns the bar, then.

Edit

Green threads > Green threads in other languages: https://en.wikipedia.org/wiki/Green_thread#Green_threads_in_...

Coroutine > Comparison with > Threads, Generators: https://en.wikipedia.org/wiki/Coroutine#Implementations_for_... :

> Generators, also known as semicoroutines, [8] are a subset of coroutines. Specifically, while both can yield multiple times, suspending their execution and allowing re-entry at multiple entry points, they differ in coroutines' ability to control where execution continues immediately after they yield, while generators cannot, instead transferring control back to the generator's caller.[9] That is, since generators are primarily used to simplify the writing of iterators, the yield statement in a generator does not specify a coroutine to jump to, but rather passes a value back to a parent routine.

> (However, it is still possible to implement coroutines on top of a generator facility)

Asynchronous I/O > Forms > Light-weight processes or threads: https://en.wikipedia.org/wiki/Asynchronous_I/O#Light-weight_...

Async/Await > History, Benefits and criticisms: https://en.wikipedia.org/wiki/Async/await



> That is, since generators are primarily used to simplify the writing of iterators, the yield statement in a generator does not specify a coroutine to jump to, but rather passes a value back to a parent routine.

Another term for this asymmetric coroutine, as opposed to symmetric coroutine. Coroutines in Lua are asymmetric, but they're not generally referred to as generators as they're much more capable than what are called generators in other languages, like Python. This is largely because Lua's coroutines are stackful rather than stackless, which is an orthogonal, more pertinent dimension when implementing concurrency frameworks.

You can implement symmetric coroutines using asymmetric coroutines, and vice versa, by implementing a higher-level library that implements one using the other. So in principle they have equivalent expressive power, formally speaking. Ultimately the distinction between these terms, including generator, comes down to implementation details and your objective. And just because a language name-drops one of these terms doesn't mean what they provide will be as useful or convenient in practice as a similarly named feature in another language. Other dimensions--stack semantics, type system integration, etc--can easily prove the determining factor in how useful they are.


Great summary.

This paper from one of the Lua creators digs into this in the paper Revisiting Coroutines. It is a very readable paper. https://www.inf.puc-rio.br/~roberto/docs/MCC15-04.pdf


PROMPT: Generate a table of per- process/thread/greenthread/coroutine costs in terms of stack/less/heap overhead, CPU cache thrashing impact, and compatibility with various OS schedulers that are or are not preferred to eBPF

Is it necessary to use a library like trio for nonblocking io in lua, or are the stdlib methods all nonblocking with big-O complexity as URIs in the docstrings?

Trio docs > notes on async generators: https://trio.readthedocs.io/en/stable/reference-core.html#no...


Can you please rewrite this in English?


IIRC the history of the async things in TLA in order: Twisted (callbacks), Eventlet (for Second Life by Linden Labs), tornado, gevent; gunicorn, Python 3.5+ asyncio

[ tornado (FriendFeed, IPython Notebook (ZeroMQ (libzmq)),), Sanic (asyncio), fastapi, Django Channels (ASGI), ASGI: Asynchronous Server Gateway Interface, django-ninja, uvicorn (uvloop (libuv from nodejs)), ]

The Async/await keywords were in F# (2007), then C# (2011), Haskell (2012), ... Python (2015), and JS/ES ECMAScript (2017) FWICS from the wikipedia article.

When we talk about concurrency and parallelism, what are the different ~async patterns and language features?

Processes, Threads, "Green Threads", 'generator coroutines'

Necessarily, we attempt to define such terms but the implementations of the now more specifically-named software patterns have different interpretations of same, so what does Wikipedia have or teach on this is worth the time.


Uvicorn docs > Deployment > Gunicorn:

https://www.uvicorn.org/deployment/#gunicorn :

> The following will start Gunicorn with four worker processes:

  gunicorn -w 4 -k uvicorn.workers.UvicornWorker
> The UvicornWorker implementation uses the uvloop and httptools implementations.

PROMPT: Generate a minimal ASGI app and run it with Gunicorn+Uvicorn. What is uvloop?

PROMPT: How does uvloop compare to libzmq and eBPF? Which asynchronous patterns do they support?

PROMPT: Which Uvicorn (security) http headers work with which k8s Ingress pod YAML attributes and kubectl?

PROMPT: (Generate an Ansible Role and Playbook to) Host an ASGI webapp with Kubernetes (k8s) Ingress maybe with ~k3d/microshift locally


If you want to write the history of Python async things in order, you'll need to put Twisted in many more of the places: it was callbacks only in the very beginning, then worked via generators, and once Python added async syntax used that. "Twisted (callbacks)" is a simplification that ignores the influence Twisted has had even on non-Python ecosystems; Deferreds have been imitated all over the place.


Before callbacks, there were function pointers and there was no Garbage Collection; And before function pointers, there were JMPs, trampolines, and labels in ASM.

I don't share any reverence for the Twisted callback patterns that AJAX also implements. And, the article isn't about callbacks.

Promises in JS have a separate success and error functions. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...

MDN > Async function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... :

> The async function declaration creates a binding of a new async function to a given name.

> The await keyword is permitted within the function body, enabling asynchronous, promise-based behavior to be written in a cleaner style and avoiding the need to explicitly configure promise chains




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: