Concurrency Decision Maker
Advanced · Write the code · from Python Threading vs Multiprocessing vs asyncio: When to Use What
From the lesson: Python Threading vs Multiprocessing vs asyncio: When to Use What
Most programs you've written so far do one thing at a time. But real applications need to handle multiple tasks: downloading files while updating a progress bar, serving web requests from many users, or crunching numbers across all CPU cores.
Read the lessonWrite a function classify_task(description) that takes a task description string and returns the recommended concurrency tool.
Rules:
"threading""multiprocessing""asyncio""sequential"Test with these descriptions:
"Download 100 files from S3""Calculate prime numbers""Handle 5000 WebSocket connections""Print hello world"# Write the classify_task function
# Test with the four descriptions
More Concurrency exercises
- Build a Thread-Safe CounterAdvanced
- Predict the Output: asyncio.gatherAdvanced
- Fix the Bug: Missing LockAdvanced
- Build a Task QueueAdvanced
All Python exercises · 50 practice problems · Advanced Python quiz