[metapost] Dumping preloaded executables in the [g]?olden days

Nelson H. F. Beebe beebe at math.utah.edu
Wed Jan 5 20:22:14 CET 2005

Laurence Finston <lfinsto1 at gwdg.de> asks this morning on the
metafont/metapost lists about preloading TeX and Metafont with
already-compiled/processed macro packages.

Below is a demonstration in TOPS-20 on the KLH10 simulator that I ran
just now to show how easy it was for Don Knuth to provide for
preloading of large macro packages in TeX and Metafont on TOPS-20.

The KLH10 simulator, running on a Sun Blade 2500 with dual 1.28GHz
CPUs, is about six times faster than our original DEC-20/60 was; that
system was retired on 31-Oct-1990.  The original system cost was over
$250K, and one served the College of Science at Utah for 12 years, and
another the Department of Computer Science for about 10 years.

Now with either of two PDP-10 simulators, I can relive life on TOPS-20
(for me, 1978--1990). I arrived in Utah a year after Don Knuth began
the TeX project at Stanford, and we both had similar machines.  At the
time, DEC-10s and DEC-20s (different O/S, similar PDP-10 hardware)
were the backbone of the Arpanet, of which Utah and Stanford were two
of the five founders in 1969 --- the others were UC/Berkeley, UC/Los
Angeles, and UC/Santa Barbara.  My system ran TOPS-20, Don's ran LOTS
(Low-Overhead Timesharing System) at SCORE, and Richard Stallman's ran
ITS (Incompatible Timesharing System) at MIT.  Code developed on any
of these would run with minor mods on the others because of the common
PDP-10 hardware.  Thus, we all had, used, and loved Richard's Emacs
built on top of Dan Murphy's TECO (Text Editor and Corrector).  Dan's
wife Sarah headed the DEC Fortran team, and I'm writing this message
in mm (a C translation from Columbia University of the original DEC-20
assembly-coded mail program) and GNU Emacs (a reimplementation in C
and Lisp of the original TECO and assembly-coded PDP-10 emacs) ... see
how we're all connected!  

Although TeX and Metafont started out written in SAIL (Stanford
Artificial Intelliengence Language) [Don says that it was because SAIL
had a good debugger], the 1981--1982 rewrite in Pascal relied on the
availability of Chuck Hedrick's excellent Pascal compiler from
Rutgers, bootstrapped in Pascal and PDP-10 assembly code, if I recall

Here is the demonstration (using Fortran, because that is the only
compiler that I have at the moment):

;;; The funny mixed case happens when I type ESCape for command and
;;; filename completion.

 Wednesday, January 5, 2005 11:59:19

 TOPS-20AN Maximum System, TOPS-20AN Monitor 7(21017)
 TOPS-20 Command processor 7(4143)

@type restRT.foR.3
00100         program restart
00200   * Demonstrate TOPS-20 restart
00300         character*40 line1, line2
00400         logical init
00500         data init /.false./
00600         if (.not. init) then
00700             write (6,'('' ONE: Enter a line of data: '', $)')
00800             read (5,'(a)') line1
00900             write (6,'('' You typed: ['' A '']'')') line1
01000             init = .true.
01100         end if
01200         write (6,'('' TWO: Enter a line of data: '', $)')
01300         read (5,'(a)') line2
01400         write (6,'('' You typed: ['' A '']'')') line2
01500         write (6,'('' You originally typed: ['' A '']'')') line1
01600         call exit
01700         end

;;; Compile and link the program into an executable image in memory

@load restrt.for
LINK:   Loading

;;; Save the memory image as an executable program

@save restrt

;;; Run the program, and interrupt it with Ctl-C after the second prompt

@run restrt
ONE: Enter a line of data: Initial stuff
You typed: [Initial stuff                           ]
TWO: Enter a line of data: ^C

;;; Save the interrupted image as an new program

@savE (on file) new-restrt

;;; Run the interrupted program: notice that it continues from
;;; the point that it left off, because init is now .true.
;;; All of its local variables are still available, because they
;;; are static in C-ese (i.e., not allocated on the stack).

TWO: Enter a line of data: More stuff
You typed: [More stuff                              ]
You originally typed: [Initial stuff                           ]
CPU time 0.01   Elapsed time 3.78

TeX and Metafont use a magic integer constant instead of a Boolean
variable: ready_already has the value 314159 after the initial

No special hacks or magic system calls were needed to do this, so even
user programs on TOPS-20 made use of the feature to eliminate the
overhead of reprocessing startup data on every run.

- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -

More information about the metapost mailing list