Talk:Keyboard buffer
This article is rated Stub-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
what is the maximum buffer size of the buffer which is specified for the keyboard? — Preceding unsigned comment added by 58.27.144.102 (talk • contribs) 18:07, 31 October 2011 (UTC)
Confusing two concepts
[edit]There are two distinct concepts here:
- A queue of keystrokes received from the keyboard and waiting to be processed.
- A line buffer which is a feature of most text terminals.
As written, the article is confusing the two. The distinction is clear under MS-DOS, and is still relevant to the command prompt and other console-mode programs under modern Windows. When a key is pressed, a representation of the keystroke is written to the keyboard buffer. This keystroke could be a character or a control key. I surmise that pressing a key triggers a hardware interrupt, the handler of which converts the keystroke into a character or control code (taking into account the configured keyboard layout and any active modifier keys and/or locks) which is then stored in the keyboard buffer. And furthermore, that this interrupt makes exceptions to provide special handling for such keystrokes as Ctrl+Break, Ctrl+C, Pause and Ctrl+Alt+Del. Software then reads keystrokes from the keyboard buffer and does whatever with them. If the software is reading from the standard input, this whatever will be pulling characters from the keyboard buffer into the line buffer, and processing control keystrokes. Echoing the character to the display is part of this processing, not the functionality of the keyboard buffer. Applications can also pull key codes from the keyboard buffer and process them directly, without going through the terminal line buffer.
So it may be a bit different when a terminal is being used to interact with a remote computer. I suppose there are two possibilities:
- The terminal is maintaining a line buffer, which is sent en bloc to the remote computer when Enter is pressed. In this scenario, control keys would be processed by the terminal.
- The terminal is sending key codes on the fly, and possibly echoing them to the display in the process. In this scenario, control keys would be processed by the remote computer.
Maybe what is sent to the remote computer becomes said computer's "keyboard buffer". But still, "As a user enters a command, they see it echoed on their terminal and can edit it before it is processed by the computer" has little if anything to do with any keyboard buffer. In case 1, it is a line buffer, and the deleted characters never reach the keyboard buffer of the remote computer. In case 2, likewise the user is not editing the existing contents of any keyboard buffer, but adding control key codes to it; it is the line buffer (if the remote computer is operating in this way) from which characters are removed when a backspace code is received.
As such, I say the article needs to be rewritten to distinguish clearly between a keyboard buffer and a line buffer.... — Smjg (talk) 00:29, 21 June 2022 (UTC)