Reputation: 47
Is it at each screen refresh or exactly when keys are pressed (through interrupts etc.)?
Upvotes: 0
Views: 168
Reputation: 21627
That largely depends on the device. There were effectively three generations of devices:
Polling
Character interrupts. Each key press generates an input.
Programmed interrupts. The device is configurable so that it only generates an interrupt when necessary. For example, some terminal devices support programming such that the user can enter a string of characters (and even edit those characters) and there is only an interrupt when the user hits <RETURN>.
Upvotes: 2
Reputation: 24867
On all non-trivial systems, I/O events are signaled by hardware interrupts that cause drivers to be run. No polling is required or desired.
Any thread waiting on KB input will be made ready, and hopefully running, when the KB driver exits. It can then handle the KB event.
Upvotes: 0