asynchronous - understanding python twisted asynchronicity in terms of operating system -


i'm new twisted library , i'm trying understand how done operations in python/twisted performed asynchronously. far thought gui-alike (qt or javascript) platforms use event-driven architecture extensively.

facts:

  • twisted programs run in 1 thread = no multithreading
  • reactor , deferred patterns used: callbacks/errbacks declared , execution of controlled reactor main loop
  • a single cpu can never parallelly, because shares resources between processes, etc. parallel code execution mean programming platform (python, javascript, whatever) executes more 1 sequence of operations (which can done, example, using multithreading)

question 1

python seen high-level wrapper operating system. os functions (or c functions) provide asynchronous operation handling? there any?

question 2

q1 leads me idea, twisted's asynchronicity not true asynchronicity, have in javascript. in javascript, example, if provide 3 different buttons, attach callback functions them , click 3 buttons - 3 callbacks executed parallelly. parallelly.

in twisted - far understand - it's not true asynchronicity - it's, let's say, approximated asynchronicity instead, since no operations performed parallelly (in terms of code, mentioned in fact3). in twisted first n line of code (defining protocols, factories, connections, etc.) declarations of going happen when entire system starts. nothing runs far. real execution starts reactor.run() fired. understand reactor runtime based on single while true loop iterates through events. reactor checks awaiting tasks do, processes them, send result queue (either callbacks or errbacks). in next loop execution they'll processed 1 step further. deferred execution linear in fact (though, outside looks executed parallelly). interpretation correct?

i'd appreciate if answer questions and/or explain how asynchronicity works in twisted/python platform , how related operating system. in advance explanations!

edit: links articles explaining asynchronicity welcome!

it's hard talk without defining lot of terms more precisely , taking issue facts, here's attempt:

question 1:

try man select, approximately how twisted implemented - it's way ask operating system monitor several things @ once , let application know when 1 of them fires (block on multiple things).

question 2:

yeah, pretty - you're wrong javascript, it's twisted.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -