|
|
Subscribe / Log in / New account

An introduction to asynchronous Python

An introduction to asynchronous Python

Posted Jun 30, 2017 12:43 UTC (Fri) by excors (subscriber, #95769)
Parent article: An introduction to asynchronous Python

> There are not many things that are better for async in that comparison. The main advantage to asynchronous programs for Python is the massive scaling they allow, Grinberg said.

I think the main advantage of the async model over threading may be that you don't have to understand synchronisation - it avoids all those mutexes, semaphores, events, conditions, atomics, implicitly atomic operations in a particular interpreter implementation, GIL, ... Instead, all your code is guaranteed to run atomically except where there's a clearly-visible "await". Given that essentially no human beings are capable of understanding synchronisation perfectly in any non-trivial cases, that's a substantial benefit.


to post comments

An introduction to asynchronous Python

Posted Jul 1, 2017 0:25 UTC (Sat) by neilbrown (subscriber, #359) [Link] (1 responses)

> Given that essentially no human beings are capable of understanding synchronisation perfectly in any non-trivial cases,

That's a bold claim!
I think it much more likely that we don't have, or are not using, suitable semantic tools to enable us to think about synchronization in a reliable way.
By "semantic tools" I mean things like "loop invariants", which I personally find make it much easier to think accurately about loops.
I think a lot of synchronization errors come about because people are either not informed about the locking requirements, or think they can take a short cut without justifying it. This suggests that it isn't a lack of capability, but a lack of tools and training.

You point still stands, though, that it may be easier to train people in asynchrony than in synchrony.

An introduction to asynchronous Python

Posted Jul 7, 2017 17:16 UTC (Fri) by HelloWorld (guest, #56129) [Link]

The real question is why two concurrent threads would mess around with the same mutable data structure anyway. And most of the time is that they really don't, and when you stop doing that, things become much easier.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds