Chapter 3 Multiprocessing Flashcards

1
Q

Process

A

Process API takes a function to execute and runs it in a new process.
Process(target=process_task, name=”process-{0}”.format(i))

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

Fork

A

Process can be created by fork, spawn and forkserver. This is set in the library using multiprocessing.set_start_method(‘fork’)

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

Fork disadvantages

A

For copies almost everything from the current process, this could be problem with lock states, open file descriptors etc

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

Spawn

A

Spawn uses exec to replace the state. Spawn is set using multiprocessing.set_start_method(‘spawn’)

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

Forkserver

A

Need to study

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

Queues and pipes

A

Queues take items, pipes are like files.

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

Shared memory

A

created using Value

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

Locks and reentrant locks

A

as usual

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

Barrier, semaphore and condition variable

A

same as threads

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

Pool

A

Creates a pool of processes which execute multiple tasks and do not die immediately

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

Maps

A

map api are available to distribute work to a pool

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

Managers

A

Managers are a way to share data and co-ordinate between processes running on different machines.

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

Creating Manager

A

BaseManager creates a manager and binds it to a port. To connect, we create a BaseManager and call connect. Then we can call the api to get work.

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

Types of Managers

A
  1. BaseManager

2. CustomManager, subclassing from BaseManager

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

SyncManager

A

SyncManager synchronizes between server and client.

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

SyncManager Synchronization

A

SyncManager provides synchronization premitives to other processes like semaphore, mutex, cv etc.