> From: Clem Cole <clemc(a)ccc.com>
> Depends the processor. For the 11/45 class processors, you had a 17th
> address bit, which was the I/D choice. For the 11/40 class you shared
> the instructions and data space.
To be exact, the 23, 24, 34, 35/40 and 60 all had a single shared space.
(I have no idea why DEC didn't put it in the 60 - probably helped kill that
otherwise intersting machine, with its UCS, early...). The 44, 45/50/55, 70,
73, 83/84, and 93/94 had split.
> From: random832(a)fastmail.us
> the calling convention for PDP-11 Unix system calls read their
> arguments from directly after the trap instruction (which would mean
> that the C wrappers for the system calls would have to write their
> arguments there, even if assembly programs could have them hardcoded.)
Here's the code for a typical 'wrapper' (this is V6, not sure if V7 changed
the trap stuff):
_lseek:
jsr r5,csv
mov 4(r5),r0
mov 6(r5),0f
mov 8(r5),0f+2
mov 10.(r5),0f+4
sys indir; 9f
bec 1f
jmp cerror
1:
jmp cret
.data
9:
sys lseek; 0:..; ..; ..
Note the switch to data space for storing the arguments (at the 0: label
hidden in the line of data), and the 'indirect' system call.
> From: Ronald Natalie <ron(a)ronnatalie.com>
> Some access at the kernel level can be done with MFPI and MPFD
> instructions.
Unless you hacked your hardware, in which case it was possible from user mode
too... :-)
I remember how freaked out we were when we tried to use MFPI to read
instruction space, and it didn't work, whereupon we consulted the 11/45
prints, only to discover that DEC had deliberately made it not work!
> From: Ronald Natalie <ron(a)ronnatalie.com>
> After the changes to the FS, you'd get missing blocks and a few 0-0
> inodes (or ones where the links count was higher than the links). These
> while wasteful were not going to cause problems.
It might be worth pointing out that due to the way pipes work, if a system
crashed with pipes open, even (especially!) with the disk perfectly sync'd,
you'll be left with 0-0 inodes. Although as you point out, those were merely
crud, not potential sourdes of file-rot.
Noel
Apparently the message I was replying to was off-list, but it seems like
a waste to have typed all this out (including answering my own question)
and have it not go to the list.
On Tue, Jan 6, 2015, at 17:35, random832(a)fastmail.us wrote:
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/factor.s
> wrchar:
> mov r0,ch
> mov $1,r0
> sys write; ch; 1
> rts r5
>
> Though it looks like the C wrappers use the "indirect" system call which
> reads a "fake" trap instruction from the data segment. Looking at the
> implementation of that, my question is answered:
>
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/sys/sys/trap.c
> if (callp == sysent) { /* indirect */
> a = (int *)fuiword((caddr_t)(a));
> pc++;
> i = fuword((caddr_t)a);
> a++;
> if ((i & ~077) != SYS)
> i = 077; /* illegal */
> callp = &sysent[i&077];
> fetch = fuword;
> } else {
> pc += callp->sy_narg - callp->sy_nrarg;
> fetch = fuiword;
> }
>
> http://minnie.tuhs.org/TUHS/Archive/PDP-11/Trees/V7/usr/man/man2/indir.2
> The main purpose of indir is to allow a program to
> store arguments in system calls and execute them
> out of line in the data segment.
> This preserves the purity of the text segment.
>
> Note also the difference between V2 and V5 libc - clearly support for
> split I/D machines was added some time in this interval.
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V2/lib/write.s
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s4/write.s
Quoting Dan Cross <crossd(a)gmail.com>:
> On Tue, Jan 6, 2015 at 12:33 PM, Johnny Billquist <bqt(a)update.uu.se> wrote:
>
>> On 2015-01-06 17:56, Dan Cross wrote:
>>>
>>> I believe that Mary Ann is referring to repeatedly looking up
>>> (presumably different) elements in the entry. Assuming that e.g. `vi`
>>> looks up O(n) elements, where $n$ is the number of elements, doing a
>>> linear scan for each, you'd end up with quadratic behavior.
>>>
>>
>> Assuming that you'd look up all the elements of the termcap entry at
>> startup, and did each one from scratch, yes.
>
>
> Yes. Isn't that exactly what Mary Ann said was happening? :-)
Yes
> But that would beg the question, why is vi doing a repeated scan of the
>> terminal entry at startup, if not to find all the capabilities and store
>> this somewhere? And if doing a look for all of them, why not scan the
>> string from start to finish and store the information as it is found? At
>> which point we move from quadratic to linear time.
>>
>
> I don't think she said it did things intelligently, just that that's how it
> did things. :-)
>
> But now we're getting into the innards of vi, which I never looked at
> anyway, and I guess is less relevant in this thread anyway.
vi does indeed look up all the various capabilities it will need,
once, when it starts up. It uses the documented interface, which
is tgetent followed by tgetstr/tgetnum/tgetflag for each capability.
tgetent did a linear search.
>> The short of it (from what I got out of it) is that the move from termcap
>> to terminfo was mostly motivated by attribute name changing away from fixed
>> 2 character names.
>>
>> A secondary motivation would be performance, but I don't really buy that
>> one. Since we only moved to terminfo on systems with plenty of memory,
>> performance of termcap could easily be on par anyway.
>>
>
> I tend to agree with you and I'll go one further: it seems that frequently
> we tend to identify a problem and then go to 11 with the "solution." I can
> buy that termcap performance was an issue; I don't know that going directly
> to hashed terminfo files was the optimal solution. A dbm file of termcap
> data and a hash table in whatever library parsed termcap would go a long
> way towards fixing the performance issues. Did termcap have to be
> discarded just to add longer names? I kind of tend to doubt it, but I
> wasn't there and don't know what the design criteria were, so my
> very-much-after-the-fact second guessing is just that.
It's been 30+ years, so the memory is a little fuzzy. But as I recall,
I did measure the performance and that's how I discovered that the
quadratic algorithm was causing a big performance hit on the hardware
available at the time (I think I was on a VAX 11/750, this would have
been about 1982.)
I was making several improvements at the same time. The biggest one
was rewriting curses to improve the screen update optimization, so it
would use insert/delete line/character on terminals supporting it.
Cleaning up the mess termcap had become (the format had become horrible
to update, and I was spending a lot of time making updates with all
the new terminals coming out) and improving startup time (curses also
had to read in a lot of attributes) were part of an overall cleanup.
IIRC, there may also have been some restrictions on parameters to string
capabilities that needed to be generalized.
Hashing could have been done differently, using DBM or some other method.
In fact, I'd used DBM to hash /etc/aliases in delivermail years earlier
(I have an amusing story about the worlds slowest email I'll tell some
other time) but at the time, it seemed best to break with termcap
and go with a cleaner format.
On 2015-01-01 17:11, Mary Ann Horton<mah(a)mhorton.net> wrote:
>
> The move was from termcap to terminfo. Termlib was the library for termcap.
Doh! Thanks for the correction. Finger fart.
> There were two problems with termcap. One was that the two-character
> name space was running out of room, and the codes were becoming less and
> less mnemonic.
Ah. Yes, that could definitely be a problem.
> But the big motivator was performance. Reading in a termcap entry from
> /etc/termcap was terribly slow. First you had to scan all the way
> through the (ever-growing) termcap file to find the correct entry. Once
> you had it, every tgetstr (etc) had to scan from the beginning of the
> entry, so starting up a program like vi involved quadratic performance
> (time grew as the square of the length of the termcap entry.) The VAX
> 11/780 was a 1 MIPS processor (about the same as a 1 MHz Pentium) and
> was shared among dozens of timesharing users, and some of the other
> machines of the day (750 and 730 Vaxen, PDP-11, etc.) were even slower.
> It took forever to start up vi or more or any of the termcap-based
> programs people were using a lot.
Hum. That seems like it would be more of an implementation issue. Why
wouldn't you just cache all the entries for the terminal once and for
all? terminfo never came to 16-bit systems anyway, so we're talking
about systems with plenty of memory. Caching the terminal information
would not be a big memory cost.
Thanks for the insight.
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt(a)softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
Bob Swartz, founder of Mark Williams Co, has allowed the sources for
COHERENT to be published under a three-clause BSD license. Steve Ness is
hosting them. They are available here:
http://nesssoftware.com/home/mwc/source.php
For reference, for folks who don't know what COHERENT is, it started as a
clone of 7th Edition, but grew more modern features over time. Dennis
Ritchie's recollections of his interaction with it:
https://groups.google.com/forum/#!msg/alt.folklore.computers/_ZaYeY46eb4/5B…
And of course the requisite Wikipedia link:
http://en.wikipedia.org/wiki/Coherent_(operating_system)
- Dan C.
PS: I hold a soft spot for COHERENT in my heart. I became interested in
Unix in high school, but this was before Linux was really a thing and
access to other systems was still hard to come by. I spotted an ad for
COHERENT in the back of one of the PC-oriented publications at the time,
"Computer Shopper" or some such, and realized that it was *almost* within
my reach financially and that I could install it on the computer I already
owned. Over the next month or so, I scraped up enough money to buy a copy,
did so, and put it on my PC. It was quirky compared to actual Unix
distributions, but it was enough to give one a flavor for things. The
manual, in particular, did not follow the traditional Unix format, but
rather was an alphabetical "lexicon" of commands, system calls and
functions and was (I've always thought) particularly well done. Links to
the COHERENT lexicon and various other documents:
http://www.nesssoftware.com/home/mwc/.
I graduated onto other systems rather quickly, but COHERENT served as my
introduction to Unix and Unix-like systems.
PPS: Bob Swartz is the father of the late Aaron Swartz.
On 2015-01-06 17:32, Mary Ann Horton<mah(a)mhorton.net> wrote:
>
> On 01/06/2015 04:22 AM,arnold(a)skeeve.com wrote:
>>> >>Peter Jeremy scripsit:
>>>> >>>But you pay for the size of $TERMCAP in every process you run.
>> >John Cowan<cowan(a)mercury.ccil.org> wrote:
>>> >>A single termcap line doesn't cost that much, less than a KB in most cases.
>> >In 1981 terms, this has more weight. On a non-split I/D PDP-11 you only
>> >have 32KB to start with. (The discussion a few weeks ago about cutting
>> >yacc down to size comes to mind...)
>> >
>> >On a Vax with 2 Meg of memory, 512 bytes is a whole page, and it might
>> >even be paged out, and BSD on the vax didn't have copy-on-write.
>> >
>> >ISTR that the /etc/termcap file had a comment saying something like
>> >"you should move the entries needed at your site to the top of this file."
>> >Or am I imagining it?:-)
>> >
>> >In short - today, sure, no problem - back then, carrying around a large
>> >environment made more of a difference.
>> >
>> >Thanks,
>> >
>> >Arnold
> Even with TERMCAP in the environment, there's still that quadratic
> algorithm every time vi starts up.
I must be stupid or something. What quadratic algorithm?
vi gets the "correct" terminal database entry directly from the
environment. Admittedly, getting any variable out of the environment
means a linear search of the environment, but that's about it.
What am I missing? And once you have that, any operation still means
either searching through the terminal definition for the right function,
which in itself is also linear, unless you hash that up in your program.
But I fail to see where the quadratic behavior comes in.
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt(a)softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
A very nice addition to the archives. Thank you.
I well remember our disbelief that Mark Williams wrote all its own
code, unlike other vendors who had professed the same. As Dennis
described, we had fun putting together black-box tests that
recognized undocumented quirks (or bugs) in our code. We were
duly impressed when the results came back negative.
Doug
A prosperous New Years to all us old UNIX farts.
Years ago the USENIX conference was in Atlanta. It was a stark contrast between us and the Southern Baptists who were in town for their conference as well (punctuated at some goofball Baptist standing up in the middle of one of the restaurants to sing God Bless America or some such).
Anyhow, right before the conference someone (I think it was Dennis) made some comment about nobody ever having asked him for a cast of his genitals. A couple of friends decided we needed to issue genital casting kits to certain of the UNIX notables. I went out to an art supply store and bought plaster, paper cups, popsicle sticks to mix with, etc… Gould computers let me use one of their booth machines and a printer to print out the instructions. I purloined some bags from the hotel. It was pointed out that you need vaseline in order for the plaster to not stick to the skin. Great, I head into the hotel gift shop and grab ten tiny jars of vaseline. As I plop these on the counter at the cashier, she looks at me for a minute and then announces…
I guess y’all aren’t with the baptists.
People took it pretty tongue in cheek when they were presented. All except Redman who flew off the handle.
Dave Horsfall:
> At yet another, we had a Sun 3/50 window connected to a Convex, and acted
> all innocent when various dweebs did the old "echo 99k2vp..." etc trick.
John Cowan:
High-precision approximation to sqrt(2). What's the trick?
======
Not really a trick, just a hoary old zero-order CPU benchmark:
echo 99k2vp | time dc
You can see why letting people type that on a Convex thinking it was
a Sun 3/50 might have entertainment value.
Modern systems are far too fast for that to be worth while, though.
I still use a variant of it: a shell script called dc-N, containing
dc <<!
99k[2vszla1-dsa0<b]sb${1-500}salbx
!
meant to be invoked as
time dc-N 10000
or the like. (The internal default of 500 has long since gone
stale too, of course.)
Norman Wilson
Toronto ON
On 2014-12-31 21:14, Clem Cole<clemc(a)ccc.com> wrote:
>
> Jake - you have lots of help from others and using curses(3) is definitely
> the right way to program.
>
> But to answer your specific question about printf(string), according to
> Chapter 3 (Programmer's Info) of my old VT-100 user's guide, I think what
> is you are doing wrong is that "\033c" is not the ANSI clear to end of
> screen command.
Right...
> When I saw your message on my iPhone last night, the cache said - wait that
> can't be correct. But I could not remember why. So I had to wait until
> I got back home today to look in my basement.
>
> As I suspected, it's not an ANSI sequence. So are you running in VT-100
> (ANSI) mode or VT52 mode? I ask because it is close to the VT52 cursor
> right command which is actually: "\033C" but I do not remember is case
> mattered.
Case do matter.
> In VT52 mode you need to send the terminal: "\033H\033J" to clear the
> screen.
>
> In ANSI mode, it becomes: "\033[1;1\033[0J"
Shorter form: "\033[H\033[J"
> A few things to remember:
> 1.) Clear takes the current cursor position and clears from there to end of
> X (where X depends on mode, and type of clear). So you need to move the
> cursor to home position (aka 1,1).
Not really. It's way more advanced than that.
If we start with the generic clear screen, it is CSI Pn J
Where CSI can be expressed as ESC [ (or "\033[" in the same parlance as
above.)
Pn, then is an argument to the function, while J is the actual function
(clear screen in this case).
Now, Pn can cause many things:
0 Clear from cursor to end of screen
1 Clear from cursor to end of screen
2 Clear from beginning of screen to cursor
3 Clear whole screen
If no argument is given, the default is 0.
> 2.) VT-100's did not implement the full ANSI spec like Ann Arbor, Heathkit,
> Wyse etc. So there are a number of things that those terminals did
> better. A really good reason to you curses(3) because all the knowledge is
> keep in the termcap and as a programmer you don't need to worry about it.
Probably true. However, I'm not sure Ann Arbor or Heathkit did much
better. As far as I can remember, they were always more "weird", but I
might just be confused. However, curses(3) is definitely a good way of
not having to care about different terminal oddities.
> 3.) I saw sites were VT52 mode was sometimes preferred because it was good
> enough for most editing, and needed fewer chars to do manipulation. On
> slow serial lines, this sometimes was helpful. That said, give me an AAA
> any day. Like others, I still miss that terminal.:-)
Yeah, the VT52 was simpler, and had shorter control strings. But of
course, with the additional limitations that came with that.
Personally, I'd give an AAA or a Heathkit away if one was dropped on me.
A VT100 I would keep. :-)
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt(a)softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol