The operation of the terminal and serial device drivers for non-intelligent serial I/O cards is shown in ``Processing of input and output characters by the character list-based terminal driver''. Characters entered at a keyboard are received over a serial line and detected by the universal asynchronous receiver/transmitter (UART) on the serial card. On non-intelligent serial cards that use either a 8250 or a 16450 UART, a hardware interrupt is generated for every character that is received. The 16550 UART can buffer up to 16 characters and so does not generate as many interrupts per character.
The serial I/O (sio) driver's interrupt handling routine transfers the character(s) from the UART to the input buffer of the serial driver for every interrupt it receives. If the input stream of characters is not continuous, the 16550 will time out and generate an interrupt anyway. This prevents the interactive response experienced by a user being affected by the presence of the buffer.
Processing of input and output characters by the character list-based terminal driver
The input characters are next moved to a character block buffer in the terminal driver (tty) before being moved to the raw input queue. If echoing is enabled, input characters are copied to the output queue as shown in ``Processing of input and output characters by the character list-based terminal driver''. This enables characters typed by a user to be displayed on their screen. If the line is set to canonical mode, the tty driver processes the characters looking for newline, keyboard signals such as ERASE (erase character), INTR (interrupt), and EOF (end-of-file), and international keyboard mapping. The processed characters are put on the canonical queue from where they can be copied to the user's process. If the terminal is set to raw mode, no characters are processed -- every character typed is passed to the application.
Output characters from the application program are copied to the output queue before being moved through various output buffers, onto the UART and back to the terminal screen for display.
The main resource that you can tune is the number of character blocks used to implement the character lists used by the terminal driver. Each character block (cblock) consists of a 64-byte buffer and an 8-byte header. A character list (clist) is formed from a linked list of character blocks. It grows by adding another block to its end. The total number of character blocks that are available for use is controlled by the kernel parameter NCLIST. If necessary, you can increase the number of available character blocks using setconf(ADM) but this change only remains in force until you next reboot the kernel. Use configure(ADM) to make permanent changes to the number of character blocks configured.