cooperative multitasking
Cooperative multitasking is a scheduling approach in which each running task keeps control of the CPU until it voluntarily yields, rather than being interrupted by the operating system. Because no task can be forced to pause, the scheduler relies on every task to hand control back on its own, usually at a defined yield point.
Running without interruption between those yield points has real advantages. Shared data cannot change halfway through an operation, so a task needs far less locking to stay correct, and switching between tasks stays cheap because no timer interrupt is involved.
The trade-off is fragility. One uncooperative task breaks the whole model, because a task stuck in a long computation or a blocking call never yields, so it starves the others and can freeze the entire system.
The widget below lets you watch three tasks hand off a single CPU at their yield points, then make one task refuse to yield and see the others starve:
Early desktop systems such as Windows 3.x and classic Mac OS scheduled programs this way before preemptive multitasking took over. The pattern still underpins asynchronous programming, where an event loop runs one coroutine at a time and each coroutine yields at an await expression so the loop can resume another. Python’s asyncio drives concurrent work on a single thread in exactly this cooperative style.
Related Resources
Tutorial
Async Programming in Python: From Generators to asyncio
Learn how Python async programming works. Write async functions with async and await, and run slow I/O operations concurrently with asyncio.
For additional information on related topics, take a look at the following resources:
- Hands-On Python 3 Concurrency With the asyncio Module (Course)
- Speed Up Your Python Program With Concurrency (Tutorial)
- Python's asyncio: A Hands-On Walkthrough (Tutorial)
- Python 3.14 Release Candidate Lands: Faster Code, Smarter Concurrency (Tutorial)
- Speed Up Python With Concurrency (Course)
- Async Programming in Python: From Generators to asyncio (Quiz)
- Python Concurrency (Quiz)
- Python's asyncio: A Hands-On Walkthrough (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Martin Breuss • Updated Nov. 20, 2026