Long time ago I had an old IBM PS/2 that I had fished out of a dumpster. It ran IBM DOS 5.0 and was a solid little machine. Occasionally I would encounter the following scenario, and I recently started wondering what was going on internally:
Sometimes a program would hang, absolutely unresponsive to all user input with nothing on the screen updating (aside from the cursor blink, if it was in text mode). I would have to Ctrl+Alt+Del to reboot and get it running again. When the computer was in this state, keypresses would do nothing, until I had typed something like 5, 10, 15 (don't remember the precise number) keys. After the requisite number of keypresses, each keypress thereafter would cause the PC speaker to emit a short beep.
As a user, I understood the meaning to be "your actions are not productive, stop it." However nowadays I've been learning more about the way these systems worked, and it got me wondering what was actually happening inside. Presumably the program I was running at the time got wedged, either stuck in an infinite loop or blocked waiting for an interrupt that never came. Obviously the beep was not something the program itself was doing. And yet, to emit a beep, something in the system had to set the tone frequency in the Programmable Interrupt Timer and open the speaker output gate for a moment.
What was actually "counting" my keypresses? Did it have a full-fledged hardware input buffer, and for what purpose? What was actually responsible for controlling the speaker?