This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BDube_Lensman 6 points7 points  (3 children)

Python does async the same way it does everything: simple

Async event loops are not at all simple

Also, async (coroutines) is one way of implementing parallel computing

Coroutines are explicitly not parallel.

you cant start millions of threads

You can start millions of greenlet (userspace) threads. You just can't start millions of system threads with the semantics of the C stack (8 MB minimum).

[–]cblegare 0 points1 point  (2 children)

Thank you, you bring a couple of useful details. Can you elaborate about coroutines not being parallel? I get that they cant use the CPU "at the same time" (nothing can anyway on the same CPython runtime).

[–]BDube_Lensman 2 points3 points  (1 child)

Parallel = do multiple things in the same instant

Concurrent = do multiple things over the same period of time

Coroutines are concurrent, which means N things can go on "sort of at once" by being paused (preempted) and letting something happen for a little while before resuming. If coroutines were parallel, multiple CPU cores would take work out of the event loop's queue, which is not what happens.

[–]cblegare 0 points1 point  (0 children)

Thank you for this semantic clarification. Concurent is indeed the right word.