Hardware-Driven Switching $\Longleftarrow$ Resource Management

You will notice that both examples given were self-contained. Neither interacted with the outside world, other than to display their status on the screen. However our context switch can be used for more than a expressive programming abstraction for individuality and interprocess communication. Its real benefits come from increasing the efficiency of programs, so they do not waste time waiting for I/O operations to complete –which most programs spend most their time waiting for. For example, the context switch can be used to transfer data files between systems in the background, only switching to the file transfer program when a character has been received from the communications port. Or they can be used for more sophisticated optimizations: for example, when waiting for the user to type a character, recomputing the values of a spreadsheet or saving the files of a word processor.

These applications of background, interrupt-driven I/O and, in general, good resource management. Though they are beyond the scope of this article, future articles built upon this context switch will cover them and show you the magic you never thought your computer could do!