How do input devices and interrupts work?
Your keyboard is a very simple input device; simple because it generates small amounts of data very slowly (by a computer’s standards). When you press or release a key, that event is signalled up the keyboard cable to raise a hardware interrupt. It’s the operating system’s job to watch for such interrupts. For each possible kind of interrupt, there will be an interrupt handler, a part of the operating system that stashes away any data associated with them (like your keypress/keyrelease value) until it can be processed. What the interrupt handler for your keyboard actually does is post the key value into a system area near the bottom of memory. There, it will be available for inspection when the operating system passes control to whichever program is currently supposed to be reading from the keyboard. More complex input devices like disk or network cards work in a similar way. Earlier, I referred to a disk controller using the bus to signal that a disk request has been fulfilled. What a