[TUHS] Job Control and other terminal fun

Ron Natalie ron at ronnatalie.com
Tue Jan 31 02:31:52 AEST 2023


A lot of this dates back from the old “tty” days (or at least crt 
terminals that were still alphanumeric).    Even the concept of putting 
a job in the background with & is really a feature of trying to 
multiplex multiple tasks on the same dumb terminal.   This is indeed 
less important with windowing things like the DMDs or modern windowing 
workstatiosn when you can just get another window.    The Berkeley job 
control was an interesting hack.   For us at BRL the problem was I 
absolutely detested the C shell syntax.   The Korn shell hadn’t escaped 
from AT&T yet,  so, I spent time figuring out how that really worked in 
the C shell (not really well documented), mostly by inspection, and then 
reimplemented it in the Bourne Shell (we were using the System V source 
code version for that).    I still couldn’t get traction at BRL for 
using the Bourne shell because by that time, tcsh had come out with 
command line editing.   So back to the shell sources I went.   By this 
time, 5R2 had come out so I grabbed the shell source form that.   I was 
very delighted to find that the macros that made C look sorta like Algol 
had been unwound and the thing was back to straight C.   I reworked 
emacs-ish command line editing into the shell.   Subsequently, I had a 
nice conversation with David Korn at USENIX, being probably at that 
point the two most familiar with Bourne shell job control internals. I 
also sat down with the guys writing either bash or the pdksh (can’t 
remember which) and explained all how this work.  As a result my name 
ended up in the Linux manpages which was pretty much all I found for a 
while when I googled myself.

Years later, I had left the BRL, spent three years as a Rutgers 
administrator and was working for a small startup in Virginia.   There 
was a MIPS workstation there.    I was slogging along using ed (my 
employees always were amazed that if there was no emacs on the system, I 
just used ed, having never learned vi).   Not thinking about it, I 
attempted to retrieve a backgrounded job by typing “fg.”   To my 
surprise the shell printed “Job control not enabled.”   Hmm, I say.  
That sounds like my error message.   “set -J” I type.   “Job control 
enabled.”   Hey! This is my shell.    Turns out Doug Gwyn put my mods 
into his “System V on BSD” distribution tape and it had made its way 
into the Mach code base and so every Mach-derived system ended up with 
it.   Certainly, I found it convenient.

There have been other schemes other than job control to multiplex 
terminals.    IBM in the AIX that ran on the 370/PS2/i860 had a device 
called the High Function Terminal that allowed you to swap screens on 
the console.   When we implemented the i860 (which was an add in card 
for the micro channel), we called our console the Low Function Terminal.

Then after spending some time on MIT’s ITS and TOPS20, I got intrigued 
by the fact on those systems you could have a “shell” that persisted 
across logins and could be detached and reattached on another device at 
another time.    I set about making such an implementation.    Not 
particularly efficient, it essentially grabbed one of the BSD ptys and 
spawned the shell there and then a small alternative login shell 
forwarded the real tty to that.    You could then detach it leaving the 
shell running on the PTY and reattach it elsewhere.    Much like ITS, 
on. login it reminded you that you had a detached shell running and 
offered to reattach it rather than spawning a new one (complete with the 
ITS-ish: space for yes, rubout for no).   It never really caught on.

Oh well, pardon my ramblings.

-Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20230130/1d9f24dc/attachment-0001.htm>


More information about the TUHS mailing list