Concurrency in Python Flashcards
(10 cards)
What are the libraries for concurrency in Python?
Threading, processing and asyncio
Is asyncio for threading or multiprocessing?
Threading
How can workloads be bound?
IO-bound, CPU-bound
What is a IO-bound workload?
A workload which spends most time on R/W to memory.
What is a CPU-bound workload?
A workload which spends most time on compute.
What are the different parts of a computer?
CPU, memory, storage, peripherals
What is latency?
It’s the difference between the time to execute different workloads. For example between executing an instruction and referencing memory.
What is time-slicing?
Fitting programs in the latency of other programs.
What’s the difference between cooperative and Pre-emptive multi-tasking?
In Cooperative Multitasking, the program willingly gives up CPU and goes into a wait state. In Pre-Emptive Multitasking, it is the OS which re-assigns CPU between programs?
Which one is more robust between Cooperative and Pre-Emptive Multitasking?
Pre-Emptive, because in Cooperative, a stuck program can freeze or keep CPU.