Explain CPU-Bound vs I/O-Bound Work
AnthropicSoftware Engineer · Technical ScreenLast updated
This question evaluates understanding of CPU-bound versus I/O-bound workloads and their interaction with concurrency models such as multithreading, asynchronous I/O, and multiprocessing in Python, including the impact of the Global Interpreter Lock (GIL) and relevance to tasks like web crawling, parsing, and heavy computation.
Define CPU-bound and I/O-bound workloads. Then compare how multithreading, asynchronous I/O, and multiprocessing behave for each type of workload, especially in Python.
Include:
- How to recognize each workload in practice.
- Concrete examples.
- How the Python GIL affects the choice.
- Which model fits tasks such as web crawling, parsing, and heavy computation.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.