Concurrency in Python Flashcards

(10 cards)

1
Q

What are the libraries for concurrency in Python?

A

Threading, processing and asyncio

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is asyncio for threading or multiprocessing?

A

Threading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can workloads be bound?

A

IO-bound, CPU-bound

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a IO-bound workload?

A

A workload which spends most time on R/W to memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a CPU-bound workload?

A

A workload which spends most time on compute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the different parts of a computer?

A

CPU, memory, storage, peripherals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is latency?

A

It’s the difference between the time to execute different workloads. For example between executing an instruction and referencing memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is time-slicing?

A

Fitting programs in the latency of other programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the difference between cooperative and Pre-emptive multi-tasking?

A

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?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which one is more robust between Cooperative and Pre-Emptive Multitasking?

A

Pre-Emptive, because in Cooperative, a stuck program can freeze or keep CPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly