File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,10 @@ <h2 id="synchronous-asynchronous-execution">Synchronous & Asynchronous Execu
242
242
Emplict context switch to foo again
243
243
Implicit swtich switch back to bar
244
244
</ pre > </ code > </ p >
245
+ < p > It is illuminating to visualize the control of the program or
246
+ walk through it with a debugger to see the context switches as
247
+ they occur.</ p >
248
+ < p > < img alt ="Greenlet Control Flow " src ="flow.gif " /> </ p >
245
249
< p > The real power of gevent comes when we use it for network and IO
246
250
bound functions which can be cooperatively scheduled. Gevent has
247
251
taken care of all the details to ensure that your network
@@ -332,16 +336,16 @@ <h2 id="synchronous-asynchronous-execution">Synchronous & Asynchronous Execu
332
336
Task 8 done
333
337
Task 9 done
334
338
Asynchronous:
335
- Task 4 done
336
- Task 5 done
337
- Task 2 done
338
339
Task 0 done
339
- Task 9 done
340
+ Task 2 done
341
+ Task 5 done
340
342
Task 7 done
343
+ Task 1 done
341
344
Task 3 done
342
345
Task 6 done
346
+ Task 9 done
347
+ Task 4 done
343
348
Task 8 done
344
- Task 1 done
345
349
</ pre > </ code > </ p >
346
350
< p > In the synchronous case all the tasks are run sequentially,
347
351
which results in the main programming < em > blocking</ em > (
Original file line number Diff line number Diff line change @@ -71,6 +71,12 @@ gevent.joinall([
71
71
]]]
72
72
[[[ end]]]
73
73
74
+ It is illuminating to visualize the control of the program or
75
+ walk through it with a debugger to see the context switches as
76
+ they occur.
77
+
78
+ ![ Greenlet Control Flow] ( flow.gif )
79
+
74
80
The real power of gevent comes when we use it for network and IO
75
81
bound functions which can be cooperatively scheduled. Gevent has
76
82
taken care of all the details to ensure that your network
You can’t perform that action at this time.
0 commit comments