Control T for TENEX
I recently wrote about FreeBSD, and while on that OS I ran “sleep 5″ then hit Control-T:
freebsd10$ sleep 5 load: 0.67 cmd: sleep 90628 [nanslp] 0.92r 0.00u 0.00s 0% 1464k sleep: about 4 second(s) left out of the original 5
Wow! This prints the “load:” and “sleep:” status lines, showing information about the process. This works with other commands too, like dd(1). The “load:” line comes from the kernel, and extra lines are up to the process. As a performance engineer, I find it pretty interesting.
This magic works via detection of a STATUS control character, Control-T, by the kernel tty driver, which then prints the load line via tty_info() on FreeBSD or ttyinfo_locked() on Mac OS X. It also sends a SIGINFO to the process, so it can run its own routine. See STATUS in the termios(4) man page.
FreeBSD has the most detailed “load:” line, beginning with the 1 minute load average, then “cmd:” and the process name and PID of the most interesting process to report on (as decided by proc_compare(), based on recentness and CPU usage), state of that process, the real, user, and system times, percent CPU, and finally its RSS (resident set size).
Mac OS X has similar details, ending with user and sys time. This sleep doesn’t do the “sleep:” line.
brendan@macbook:~> sleep 5 load: 1.05 cmd: sleep 426 waiting 0.00u 0.00s
I wish this was in other kernels as well, like illumos and Linux. While they may not support Control-T and “load:”, their processes may still have a status signal. For example, GNU dd(1) prints status on a SIGUSR1, which you can send using kill(1) from another terminal. And in another terminal, you can dig the “load:” line details out using other commands. Control-T just makes it easier.
Origins
Where did Control-T come from? In a Mac OS X forum, a 2012 post makes the comment: “Not sure if this was available before 10.7″ (2011). I don’t know if it’s new in Mac OS X, but it certainly isn’t new.
I learned about it while researching a book on Systems Performance, and reading the following in a 1972 paper on the TENEX operating system [Bobrow 72]:

Control-C was familiar, but Control-T? Having mostly used Solaris- and Linux-based systems, I wasn’t familiar with Control-T. Could it still be around?
Feeling a little foolish, I opened a terminal on my macbook and typed Control-T. Nothing. Then I tried while a command was running, and was stunned to see the status line printed.
Did TENEX, circa 1969-72, include this first? Probably. I haven’t found an earlier example, and the description in [Bobrow 72] sounds like it’s new in TENEX. I did check some docs for CTSS (1961+) and Multics (late 1960s), and didn’t find it. RSTS (1970) could be modified to support it. (Coincidentally, two days ago I was teased with a photo of RSTS from monktoberfest; original probably from here.)
I did find Control-T in a TOPS-10 (1967+) simulator, although I suspect this is a later version:
.Day: 14.86 Run: 0.00 Rd:0 Wr:0 OPSER 3+6P Ctx:1 ^C PC:401336 Input wait for CTY:
Here’s TOPS-20 (1969+), from the panda simulator, which TENEX became:
@ 16:01:04 Used 0:00:00.0 in 0:00:03, Load 0.25
Is the T in Control-T for TENEX? I don’t know. But it is for TENEX in tcsh. :-)
Have another early example? Post it in a comment!
In: TENEX · Tagged with: freebsd, macosx, TENEX, TOPS-10, TOPS-20
Notice: get_the_author_email is deprecated since version 2.8! Use get_the_author_meta('email') instead. in /home/knmngmprl21d/public_html/blogs/wp-includes/functions.php on line 3467
on October 5, 2013 at 10:05 am
Permalink
ctrl-t was always in (Open)VMS, and as VMS was a successor of sorts to TOPS I wouldn’t be surprised if it was in TOPS to begin with.
Notice: get_the_author_email is deprecated since version 2.8! Use get_the_author_meta('email') instead. in /home/knmngmprl21d/public_html/blogs/wp-includes/functions.php on line 3467
on October 5, 2013 at 11:42 am
Permalink
The common element for control-T: DEC. I first bumped into it on RSTS-E in the early-80′s (high school, ’80-’84) and again on TOPS-20 (college, ’84-’88). A 1985 RSTS/E manual mentions it on pdf page 19:
http://www.dmv.net/dec/pdf/rsts90ug.pdf
A few machines at MIT were running hacks that implemented it in BSD in the ’84+ timeframe – useful on a timesharing system to figure out if it’s just your job looping or if the machine is just overloaded.
Multics definitely didn’t have it – it tried to offload as much character-at-a-time processing onto front-end I/O processors so the main CPU wouldn’t need to take an interrupt until it had a full command line.
Some discussion of the Multics terminal I/O structure here: http://www.multicians.org/mx-net.html
Notice: get_the_author_email is deprecated since version 2.8! Use get_the_author_meta('email') instead. in /home/knmngmprl21d/public_html/blogs/wp-includes/functions.php on line 3467
on October 13, 2013 at 4:38 pm
Permalink
I have known about Ctrl-T for a while (while I was managing
FreeBSD servers) but then lost touch of it (since Linux doesn’t
have it), it is quite nifty to have. It shouldn’t be that hard to
include it in linux kernel, I wonder why it hasn’t been added
yet; should require some code additions to tty driver.