P2L5. Thread Performance Considerations Flashcards
What are the pros/cons of a multi-process (MP) implementation?
Pros:
- Simple programming
Cons:
- High memory usage
Costly to context switch
- Hard/costly to maintain shared state

What are the pros/cons of a multi-threaded (MT) approach?
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 does the Event Driven Model work? (TODO: Ask a better question?)

How does the Event-Driven Model achieve concurrency?
MP and MT: 1 request per execution context (process/thread)
Event-driven: Many requests interleaved in an execution context.

What are the pros/cons of Event-Driven Model?
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
What does the Event-Driven Model use helpers for?
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.
What are the pros/cons of helper processes in the Event-Drive Model (AMPED/AMTED)?

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