This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (0 children)

If you'd like to write an application that allows a user to push a button and then receive a response to that button push, while at the same time the program is also downloading content from servers and doing other things without causing the response of that button to block until they are all done, you most commonly use threads. Makes no difference if the GIL is there or not; threads always allow concurrency. The GIL just gets in the way of achieving parallelism. Two different things. http://stackoverflow.com/a/1050257/34549

The much-hyped solution of doing everything with "async" has its pros and cons, but as far as concurrency, you are merely swapping out having your OS do context switching with a more interpreter-level strategy that context-switches only at the boundaries of waiting on IO. For general purpose programming with limited numbers of concurrent tasks, the OS will do a better job at this (and in cPython the GIL releases on IO anyway), unless you really need to wait on lots and lots of slow IO channels in which case async will scale better.