diff --git a/python_concurrency.ipynb b/python_concurrency.ipynb index 9a5a44d..b130929 100644 --- a/python_concurrency.ipynb +++ b/python_concurrency.ipynb @@ -201,7 +201,7 @@ "source": [ "### Why you should care\n", "- lets you to pick the right tool for the right job\n", - "- python threads don't run parallely, you can still do concurrency." + "- python threads don't run parallely, but you can still do concurrency." ] }, { @@ -394,9 +394,13 @@ "metadata": {}, "source": [ "## Async\n", + "\n", + "__practical definition__\n", + "A style of concurrent programming in which tasks release their CPU while they\n", + "are waiting for some action to complete\n", + "\n", "- cooperative scheduling - need explicit code to cause task switch.\n", - "- Typically single threaded\n", - "- Since you control when task switches occur, you don't need locks for synchronization.\n" + "- Typically single threaded\n" ] }, { @@ -405,7 +409,10 @@ "source": [ "__Advantages__:\n", "- very low cost, since no context switch. Incidentally they're cheaper than function calls. Cheaper switching mechanism among all techniques. People prefer this model to locking, \n", - "- No cost of synchronization = less CPU consumption. Async servers > threaded servers. You can run many many more async tasks than threads.\n", + "- Since you control when task switches occur, you don't need locks for synchronization.\n", + "- No stack allocation\n", + "- The above two factors allow for high scalibility.\n", + "\n", "\n", "__disadvantages__:\n", "- Need code that gives up control\n", @@ -501,6 +508,7 @@ "metadata": {}, "source": [ "## Recapping\n", + "- Parallelism implies Concurrency. But Concurrency doesn’t always mean Parallelism.\n", "- Sync: Blocking operations.\n", "- Concurrency: Making progress together.\n", "- Async: Non blocking operations.\n", @@ -529,8 +537,11 @@ "## Links\n", "\n", "- [python concurrency story](https://powerfulpython.com/blog/python-concurrency-story-pt1/)\n", + "\n", "- [Python concurrency keynote - Raymond Hettinger](https://www.youtube.com/watch?v=9zinZmE3Ogk)\n", - "[Python Concurrency From the Ground Up - David Beazley](https://www.youtube.com/watch?v=MCs5OvhV9S4)\n", + "\n", + "- [Python Concurrency From the Ground Up - David Beazley](https://www.youtube.com/watch?v=MCs5OvhV9S4)\n", + "\n", "- [github repo for the talk](https://github.com/madhukar93/python_concurrency)" ] }