Skip to content

Commit 27c026b

Browse files
committed
rework event loop paragraph to significantly deemphasize queues
1 parent c944ff1 commit 27c026b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Doc/howto/a-conceptual-overview-of-asyncio.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ It's behind the scenes managing resources.
4848
Some power is explicitly granted to it, but a lot of its ability to get things
4949
done comes from the respect and cooperation of its worker bees.
5050

51-
In more technical terms, the event loop contains a queue of jobs to be run.
51+
In more technical terms, the event loop contains a collection of jobs to be run.
5252
Some jobs are added directly by you, and some indirectly by :mod:`!asyncio`.
53-
The event loop pops a job from the queue and invokes it (or "gives it control"),
54-
similar to calling a function, and then that job runs.
53+
The event loop takes a job from its backlog of work and invokes it (or "gives
54+
it control"), similar to calling a function, and then that job runs.
5555
Once it pauses or completes, it returns control to the event loop.
56-
The event loop will then move on to the next job in its queue and invoke it.
56+
The event loop will then select another job from its pool and invoke it.
57+
You can *roughly* think of the collection of jobs as a queue: jobs are added and
58+
then processed one at a time, generally (but not always) in order.
5759
This process repeats indefinitely with the event loop cycling endlessly
5860
onwards.
59-
If the queue is empty, the event loop is smart enough to rest and avoid
60-
needlessly wasting CPU cycles, and will come back when there's more work
61-
to be done.
61+
If there are no more jobs pending execution, the event loop is smart enough to
62+
rest and avoid needlessly wasting CPU cycles, and will come back when there's
63+
more work to be done.
6264

6365
Effective execution relies on tasks sharing well and cooperating; a greedy job
6466
could hog control and leave the other jobs to starve, rendering the overall

0 commit comments

Comments
 (0)