On Thu, 13 Dec 2001 11:27:26 -0500, Gunther Schadow wrote:
The PDP-8 has no concept of a
stack.
This is hillarious! Wasn't the notion of a stack arond already
before 1965?
So was a machine instruction to do multiply, but on a PDP-8 that is an add-on
hardware option
this "unique" way of handling
subroutines
Unique? Quite a few processors of that time had a store-PC-and-jump type of
subroutine call. The beloved PDP-10 had three (JSR, JSP, JSA/JRA) and
subsequent enhancements added more (JSYS, XPCW); yet it also had stacks from
its inception.
Contemporary programming languages, such as BASIC and FORTRAN, did not use
stack subroutines. It's possible that modern BASIC and FORTRAN compilers may
permit recursive subroutine calls, but doing so is still prohibited by the
language specification. Now you know why.
Stacks are very useful, but they are not the solution to everything. One of
the biggest deficiencies of C is its lack of co-routines, since it only has
the stack style of subroutine calling. Yeah, I know about setjmp/longjmp, but
those are one-way, not true co-routines.
Of course, talking about co-routines to youngsters is likely to get their eyes
to glaze over, since they won't have a clue as to what I'm talking about.
I suppose
they could not share code segments then, so if three users were
doing FOCAL, they would have 3 instances of the FOCAL code in
memory (or swapping in and out to disk.) And all this at maximally
32 kB of memory! Amazing.
The concept of shared memory appeared quite some time (late 1960s) after the
PDP-8 architecture was designed, and at first only carefully-designed programs
could use it.
I just wonder how the kernel calls were handled. The
kernel was
called "Monitor." That may be the revealing piece of it: perhaps
the Monitor was a monitor, so only one thread could ever execute
any of the monitor's code at the same time.
Non-sequitor. AFAIK, the PDP-8 operating system used invalid (in user mode)
instructions as system calls, and these were generally the same as the machine
instructions that would do the equivalent operation. Since this is an
instruction trap, it doesn't subroutine calls.
I certainly would never design an operating system that uses the user's stack
to invoke a system call.
That raises a last question: what was first, the TSS-8
kernel
called "Monitor" or the operating system technical term "monitor"?
Because nobody used the word "kernel" back then. The term "monitor"
is far
older than Dijkstra's paper.
Dijkstra's classic semaphore paper was back in
1968, and my "new"
Introduction to Programming book is printed 1968 too. AFAIK
the monitor construct is younger than the semaphore, right?
No. The term appears in the early 1960s.