Compare Multithreading and Multiprocessing
Company: Hudson
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
# Compare Multithreading and Multiprocessing
Compare multithreading with multiprocessing. Explain how address space, communication, scheduling, failure isolation, startup cost, and the language runtime affect the choice. Give one workload that favors each model and one case where a hybrid is appropriate.
### Constraints & Assumptions
- Do not reduce the answer to “I/O uses threads and CPU uses processes”; runtime and workload details matter.
- Address shared mutable state and shutdown behavior.
### Clarifying Questions to Ask
- Which language runtime and operating environment are involved?
- Is the workload CPU-bound, blocking I/O, asynchronous I/O, or mixed?
- What isolation and memory limits are required?
```hint Compare costs at the boundary
Threads share memory cheaply but synchronize it; processes isolate memory but must serialize or explicitly share data.
```
### What a Strong Answer Covers
- Memory model and communication mechanisms.
- Runtime-specific CPU parallelism constraints.
- Synchronization, crash containment, and operational complexity.
- Workload-specific examples and measured decision criteria.
### Follow-up Questions
- How would you cancel work and collect errors safely in each model?
- When can shared-memory multiprocessing become harder than threads?
Overview: Compare multithreading with multiprocessing and explain when each execution model is appropriate.