Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
202 lines (140 sloc) 7.77 KB

General

Concurrency: Taking a program that isn't running fast enough, breaking it into pieces, and "running those pieces separately." The what and how of "running separately" is where all the details and complexity lie for the various concurrency strategies.

  • On top of this, a small fraction of problems use some concurrency solutions as a structuring mechanism. Usually the driving force is "not fast enough" but sometimes (ironically) it can be "too complicated."

The concept of whether something is synchronous refers to when a function finishes vs. when a function returns. In the vast majority of Python code a function returns when it finishes, so these two points are identical, that is, synchronous. But with an asynchronous call, the function returns control to the caller before the function finishes---typically much sooner. So the two events, returning and finishing, now happen at different points in time: they are asynchronous.

If tasks don’t wait on each other then they are compute intensive

Ideally, make tasks that don’t block on other tasks (deadlock prone)

For Study and Exploration

Feel free to pull-request something you think might be helpful here

What Confuses You About Concurrency?

(Notes from an open-spaces session at Pycon 2017)

  • I don't want to think about it.
  • What about testing? New different kinds of failure modes introduced by concurrency.
  • Making sure an event is handled.
  • Martin Fowler's recent Youtube presentation on event-driven programming.
  • Twelve-factor application (Heroku came up with this term and has the list) to make things easily scalable
  • How to write things that can easily be scaled without being a hassle
  • Does async and await preclude gevent, twisted, etc.
  • How do I write code/libraries compliant with async and await?

Tools

  • Pipenv
  • Codeclimate

Miscellaneous

Many of these were collected for a general Python book, not necessarily for concurrency