Chapter 3 Processes and Threads

3.1 About Multitasking

Win32 supports multitasking, which divides the available CPU time among the threads that are competing for it. This creates the appearance of simultaneous execution of multiple processes.

To the user the advantage of multitasking is in the ability to have several applications open and working at the same time. For example, a user could edit a file with one application while another application is performing a printing operation or recalculating a spreadsheet.

To the application developer the advantage is in the ability to create applications that use more than one process, and processes that use more than one thread of execution. As an example, you could have one thread that handles interactions with the user (keyboard and mouse input), while other threads with lower priority perform the work of the application. The higher priority of the input thread means that the program is always nicely responsive to the user, while the other threads ensure that the processor can be used efficiently during the slices of time between key strokes.