In this chapter:
- Learn how the outside world, such as the network and the keyboard, lets an application know that it has data ready for processing
- Disambiguating between the terms interrupt, exception, trap and fault
- Send and receive signals between running applications
This chapter describes the process by which the outside world communicates with your operating system. Programs' execution is constantly being interrupted by the network when bytes are ready to be delivered. That is, after connecting to a database—or at any other time—the operating system could demand that your application deals with a message. This chapter describes how this process operates and how to prepare your programs for it.
In the last chapter, you learned a digital clock is periodically notifying the operating system that time has progressed. This chapter explains how those notifications occur. It also introduces the concept of multiple applications running at the same time via the concept of signals.
Signals emerged as part of the UNIX operating system tradition and can be used to send messages between different running programs.
We’ll be addressing both concepts—signals and interrupts—together as the programming model is similar but it’s simpler to get started with signals.
This chapter tends to focus on the Linux operating system running on x86 CPUs. That’s not to say that uses of other operating systems are unable to do follow along.