Search code examples
programming-languagesasynchronoussynchronousevent-driven

Event Based == Asynchronous?


Is "event based" the same as "asynchronous"?


Solution

  • No it doesn't imply that the events are asynchronous.

    In a event driven single threaded system, you can fire events, but they are all processed serially. They may yield as part of their processing, but nothing happens concurrently, if they yield, they stop processing and have to wait until they are messaged again to start processing again.

    Examples of this are Swing ( Java ), Twisted ( Python ), Node.js ( JavaScript ), EventMachine ( Ruby )

    All of these examples are event driven message loops, but they are all single threaded, every event will block all subsequent events on that same thread.

    In programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, allowing the main program flow to continue processing.

    So just because something is event driven doesn't make it asynchronous, and just because something is asynchronous doesn't make it event driven either; much less concurrent.