understanding python twisted asynchronicity in terms of operating system
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind
--
Chapters
00:00 Understanding Python Twisted Asynchronicity In Terms Of Operating System
02:55 Accepted Answer Score 5
03:26 Answer 2 Score 2
04:36 Answer 3 Score 2
04:44 Thank you
--
Full question
https://stackoverflow.com/questions/1921...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #asynchronous #twisted
#avk47
ACCEPTED ANSWER
Score 5
It's hard to talk about this without defining a lot of terms more precisely and taking issue with your facts, but here's my attempt:
Question 1:
Try man select, which is approximately how Twisted is implemented - it's a way to ask the operating system to monitor several things at once and let the application know when any one of them fires (block on multiple things).
Question 2:
Yeah, pretty much - but you're wrong about Javascript, it's just like Twisted.
ANSWER 2
Score 2
Thomas has already answered your first question but I'll like to add something extra to question 2. From the way you phrased the (second) question, it seems you many misunderstand asynchronicity. Asynchronous should not be confused with multiprocessing. Here's an example of asynchronicity. Lets say you have two tasks to complete. 1) Read a file from disk 2) Sum a couple of integers in memory
In a synchronous system, these task are done one at a time and we wait for the result of the operation before moving on to the next. In an asynchronous system we start each operation and then periodically check for the completion of each. (This is where that nifty select operation comes in) See this wiki page for more info: http://en.wikipedia.org/wiki/Asynchronous_I/O
So even on a single core system where in reality only 1 thread is running at a particular point in time, we can still have an asynchronous system so that tasks that take long (reading a file in the above example) don't throw a spanner in the works for tasks that can complete their work quickly (summing some integers in memory)
(As a side note, Twisted does have support for spawning a new threads. http://twistedmatrix.com/documents/11.0.0/core/howto/threading.html )
ANSWER 3
Score 2
I gave a half-hour talk on this exact topic at PyCon 2012. You can watch it online here.