An evolutionary journey of multitasking 5 Besides offloading a huge responsibility to every programmer writing a program for your platform, this method was naturally error-prone. A small mistake in a program's code could halt or crash the entire system. Note Another popular term for what we call non-preemptive multitasking is cooperative multitasking. Windows 3. 1 used cooperative multitasking and required programmers to yield control to the OS by using specific system calls. One badly-behaving application could thereby halt the entire system. Preemptive multitasking While non-preemptive multitasking sounded like a good idea, it turned out to create serious problems as well. Letting every program and programmer out there be responsible for having a responsive UI in an operating system can ultimately lead to a bad user experience, since every bug out there could halt the entire system. The solution was to place the responsibility of scheduling the CPU resources between the programs that requested it (including the OS itself) in the hands of the OS. The OS can stop the execution of a process, do something else, and switch back. On such a system, if you write and run a program with a graphical user interface on a single-core machine, the OS will stop your program to update the mouse position before it switches back to your program to continue. This happens so frequently that we don't usually observe any difference whether the CPU has a lot of work or is idle. The OS is responsible for scheduling tasks and does this by switching contexts on the CPU. This process can happen many times each second, not only to keep the UI responsive but also to give some time to other background tasks and IO events. This is now the prevailing way to design an operating system. Note Later in this book, we'll write our own green threads and cover a lot of basic knowledge about context switching, threads, stacks, and scheduling that will give you more insight into this topic, so stay tuned. Hyper-threading As CPUs evolved and added more functionality such as several arithmetic logic units (ALUs ) and additional logic units, the CPU manufacturers realized that the entire CPU wasn't fully utilized. For 