threading vs asyncio vs multiprocessing
Concurrency Type | Switching Decision | Number of Processors |
---|---|---|
Pre-emptive multitasking (threading ) | The operating system decides when to switch tasks external to Python. | 1 |
Cooperative multitasking (asyncio ) | The tasks decide when to give up control. | 1 |
Multiprocessing (multiprocessing ) | The processes all run at the same time on different processors. | Many |