Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Madhukar Mishra committed Oct 27, 2018
1 parent 7700e6d commit 1b726ca
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions python_concurrency.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down Expand Up @@ -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"
]
},
{
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)"
]
}
Expand Down

0 comments on commit 1b726ca

Please sign in to comment.