CPU usage of telnetd

Christopher A. Kent cak at purdue.UUCP
Sun Mar 16 02:31:26 AEST 1986


Sure enough, telnetd is expensive. So is rlogind. I wish I had the time to
do this, but I don't, so I'll pass on the idea and perhaps someone will
do the world a favor and implement it.

First, why it's so expensive: because each packet (potentially one per
character!) causes at least 2 context switches, and crosses the user/system
boundary 4 times (socket->telnetd, telnetd->pty, pty echo->telnetd, telnetd->
socket).

There are fixes to TCP that can be made to buffer several characters into
one packet; this cuts the network overhead, but doesn't affect the telnetd
performance. It seems that as long as telnetd runs as a user program,
it's doomed to be expensive.

So, I say, move telnetd into the kernel! This has worked for other operating
systems, notably TOPS-20. Build a new tty-like bottom half driver that
does telnet's options negotiations, etc., and interfaces to the top half
of the tty driver; it would look like a DH, DZ, etc. telnet options would
directly affect "stty" parameters, force signals, etc. No more using ptys
for this style of remote login.

This was done in the CSNET X.25-to-IP code for X.28/X.29 PAD access; we built
a new bottom half. In some sense, the protocol was a little simpler to deal
with (didn't have to twist TCP around inside the kernel, the board made that
a bit easier) but there's no reason why this shouldn't work in principle.

Of course, it would be nice to do the same with rlogin. The only problem
that I see there is that rlogind does some work involving the file system
during protocol startup; telnetd doesn't. (I'm talking about checking
hosts.equiv and so on.) I don't see right off how to make that happen
from inside the kernel. Perhaps the getty table for rlogind ports would 
invoke a special table that understood how to interpret the initial
protocol authorization handshake, or call login with the appropriate 
arguments... yah, it seems like that might work. In fact, both rlogind
and telnetd ports could be made to understand little goodies like passing
the terminal type and that (telnet has an option for this, too, though
4.2 doesn't seem to know how to handle/use it.)

If you do this, please let the world know so it can be farmed back into
4.4BSD (;-). And so I could have it for my systems!

Cheers,
chris



More information about the Comp.unix.wizards mailing list