P2L5. Thread Performance Considerations Flashcards

1
Q

What are the pros/cons of a multi-process (MP) implementation?

A

Pros:

  • Simple programming

Cons:

  • High memory usage

Costly to context switch

  • Hard/costly to maintain shared state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the pros/cons of a multi-threaded (MT) approach?

A

Pros:

  • Shared address space
  • Shared space
  • Cheap context switch

Cons:

  • Not simple implementation
  • Requires sychnonization
  • Need underlying support for threads on OS (not an issue today)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does the Event Driven Model work? (TODO: Ask a better question?)

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

How does the Event-Driven Model achieve concurrency?

A

MP and MT: 1 request per execution context (process/thread)

Event-driven: Many requests interleaved in an execution context.

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

What are the pros/cons of Event-Driven Model?

A

Pros:

  • Single address space
  • Single flow of control
  • Smaller memory requirement
  • No context switching
  • No sychronization

Cons:

  • Loss of cache locality
  • A blocking request/handler will block the entire process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the Event-Driven Model use helpers for?

A

When async calls are not available, helpers can be used instead.

Helpers are:

  • designated for blocking I/O operations only
  • pipe/socket based communication w/ event dispatcher => select()/poll() still ok!
  • helper blocks, but main event loop (and process) will not

At the time the Flash paper was written not all OSes were multi-threaded, so they used processes for helpers.

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

What are the pros/cons of helper processes in the Event-Drive Model (AMPED/AMTED)?

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

Compare/contrast performance of Flash, SPED, MT, MP when the data is cached and when it’s not cached.

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