Here is the video version, if you prefer it:
This is for the curious souls out there. I hope there are some. Even if you are not as curious, you will benefit from reading this as it paints the bigger picture.
You may have pondered something along the lines of: “OK, there exist processes. OK, processes have priorities. But what is the connection between hardware and software? That is, how does the operating system know that we, for example, moved our mouse? Are we dealing with signals?” Not quite, but the concept is very similar.
Here is where the concept of hardware and software interrupts comes in. Basically, hardware and software interrupts tell the operating system (the kernel): “Hey, deal with me!”. For example, pressing a key on your keyboard triggers a hardware interrupt and your operating system processes it. Interrupts also have priorities, because multiple interrupts can occur at the same time and they need to be handled according to their urgency. It is also important to note that there are programs called interrupt handlers that are executed when an interrupt occurs.
An important caveat: This is not exactly how it works, but it paints the picture. In the next post, I will clarify the details, but they are minor and don’t impact your understanding that much.
Hope you learned something new!
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.