[TUHS] V6 Console IO

Noel Chiappa jnc at mercury.lcs.mit.edu
Sat Jul 25 00:33:20 AEST 2020


    > From: Larry McVoy

    > Yeah, write is unbuffered though I think Noel is correct, it's going to
    > a tty and the tty will buffer until \n

The 'wait until newline' is on the input side.

Output is buffered (in the sense that characters are held in the kernel until
the output device can take them); but normally output will start to happen as
soon as the device is able to take them. Only a certain amount can be
buffered though, after that (the 'high water', I think it's called), the
process is blocked if it tries to do output, and awakened when the buffered
output level goes past the 'low water' mark.

Note that getchar() and putchar() are subroutines in a library; looking
at the source:

  https://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s4/getchr.s

you can see how they relate to the actual read/write calls to the OS.

    > So you probably have to set the tty in raw mode

Probably best to run such programs from something other than the main console,
because if there's a bug in the program, and the terminal is in raw mode, if
you're on the console, you may have to reboot the system to regain control of
the system. (Interrupt characters, ^D etc won't work.)

    > (sorry that I'm vague, I never ran V6).

Tnat's OK, I pretty much have the V6 kernel memorized, from working with
it back in the day... :-)

	Noel


More information about the TUHS mailing list