Wikipedia: a form of input/output processing that permits other processing to continue before the transmission has finished.
Quick overview
System resources.
Process communication is a problem.
Shared memory is an advantage
And a problem
GIL on CPython.
Avoids synchronization problems. cooperative.
Managed in user-space.
No operating system optimization for native threads
Quite a hack on Python (gevent + monkey patching).
Single thread, Single process, cooperative multitasking.
Reduces context switches and overhead
Need to make sure it's cooperative, CPU intensive code will block.
Nope. GUIs been doing it for a long time.
Good GUI developers know:
Don't block the main event loop (Looking
at you Swing).
Handle many connections without an extra overhead.
Nginx, Lighttpd, NodeJS, Twisted, Tornado ...
Not new
asyncore & asynchat available since Python 1.5.2.
Uses select (or poll).
Virtually nobody used it.
Twisted
Tornado
gevent
Uses epoll
, kexec
Feedback from Twisted, Tornado, gevent, etc.
Inter operate, not replace them.
Defines an interface which can be implemented on top of other event loops.
send()
methodyield from
, generators can return valuesadd_done_callback()
for chaining.async
,await
@coroutine
or async def
From: http://www.slideshare.net/saghul/asyncio/35
See it for a in depth overview of the subject.
HTTP client/server for asyncio