33. Event-based concurrency Flashcards

1
Q

What is even-based concurrency?

A

It’s concurrency achieved without usage of threads, but by usage of event loop that looks for events and processes them in order, utilizing async operations instead of getting thread blocked.

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

How does thread knows about events while running in event loop?

A

It achieves so through select() and poll() system calls.

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

What does select() do?

A

It examines file descriptors for readiness for read or write or errors.

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

What do interfaces for async I/O revolve around?

A

AID control block (struct aiocb)

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

How does system know about completion of async I/O operations?

A

It can either poll them or receive an interrupt when event is finished.

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

What else we need to do when using event-based approach?

A

We need to manually manage states of async requests, so that when it finishes we can finish its processing, and for that we need to persists the state of the request.

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

What should be used in event-based concurrency when system has multiple CPUs?

A

We still need to utilize locks.

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