Map each workload to the right execution model
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Map each workload to the right execution model. Rule: I/O-bound and many small waits -> 'async'; CPU-bound single-machine -> 'multiprocessing'; CPU-bound that exceeds one machine -> 'spark'. Given workloads {'api_calls':'io','image_resize':'cpu_single','petabyte_join':'cpu_cluster'}, produce a dict mapping each workload to its model and print it with keys sorted. (Model the decision, no asyncio.)
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.