Re: [Twisted-Python] Deferred documentation rewrite
Hi Edward:
Message: 2
Date: Mon, 03 Aug 2009 18:00:07 -0400
From: "Edward Z. Yang"
Why callbacks? - Asynchronous interaction to synchronous interaction - Delocalized execution (the parser example) - High level functions in Python review
I don't know if this is an aid but here goes: When I was preparing my Pycon 2008 talk, amongst the many papers I read, was the Doug Schmitt's concurrency design pattern papers including the original Reactor Pattern paper. I also read the Microsoft "Cooperative Task Management without Manual Stack Management Event-driven Programming is Not the Opposite of Threaded Programming" paper. In the light of those papers, this is the way I see things: 1) Reactors provide a portable form of non-preemptive multitasking. By implication, reactors are schedulers. 2) If you buy Reactor as scheduler, then Deferreds can be viewed as representing a thread (or chain) of execution, each callback analogous to a continuation - the next address to resume execution when a result is ready. 3) One of the main differences between asychronous and synchronous processing becomes who is responsible for setting up shared state between the links in the execution chain.
Quite frankly, I'm stumped on "defining synchronous and asynchronous."
Simple definition: In a synchronous call, the caller blocks until a result is ready. Upon return the next statement is executed (barring something like an exception). In an asynchronous call, the caller does not wait for a result and continues.
I just don't know what direction people are coming from.
I would suggest most people are trying to solve simple problems and want the least surprise. Unfortunately asynchronous programming has lots of surprises. In case of terminology, try looking up how terms like 'asynchronous' or 'synchronous' as used in a few of the more popular network programming books. Cheers, Andrew
Andrew Francis wrote:
Simple definition: In a synchronous call, the caller blocks until a result is ready. Upon return the next statement is executed (barring something like an exception). In an asynchronous call, the caller does not wait for a result and continues.
Just a thought on terminology: in the syncrhonous situation, A calls B; in async, A initiates (or triggers) B. The intent here is to remove any connotation that A might wait for a response. In line with this, B isn't a function or method, it's a task, unit of work, process, ... For what it may be worth... -- Don Dwiggins Advanced Publishing Technology
participants (2)
-
Andrew Francis
-
Don Dwiggins