On Wed, Sep 13, 2017 at 11:33 PM, Alec Muffett <alec.muffett@gmail.com> wrote:
I only know what this means due to a stint on GCOS-3 and having my boss/sysmgr explain that "threaded code" in the old sense could be smaller than the equivalent CISC binary on the same machine:


And no, it's not Threads :-)

A PDP-11 FORTRAN compiler I used back in the day was implemented this way, in part to make overlays easier (though I was young at the time, and never understood this bit). Overlays, as you may recall, were paging for systems that didn't support paging that swapped code (mostly) in/out as needed to fixed locations. The overlay manager was a quite important thing, since it automatically laid out the overlays based on calling sequences. Later versions would use MMU flipping tricks and had them aligned to 8k bounaries, but earlier versions were aligned to 512 boundaries to match the block size on the disk (since code was read-only, the OVL files were used to page code in). The Threading made the Fortran code smaller since the meat of the code was elsewhere, often in an area that wasn't overlaid... At least that's how my brain recalls things from 30-some years ago... Once I went away to college and was on a VAX or DECsystem20 (and later Sun3's and Sun4's), I swapped all this arcania out of my brain, so bit errors may have occurred before I just swapped it back in :)

Based on Doug's description, it sure sounds familiar (and somewhat triggering it turns out, but in a good way)...

There were also options to get co-routines, which is akin to a primitive 'threads' as we'd use the term today using an instruction that swapped the top of the stack and the PC, but that's different...

Warner
 
- alec



On 14 Sep 2017 6:50 am, "Larry McVoy" <lm@mcvoy.com> wrote:
Doug, could you talk about this some more?  Sort of like Reddit's
explain it like I'm 5?  Assume I'm dense but want to learn and tell
me how this worked again.  Threaded?  I'm guessing you mean that it
did paging, did that need threads in the current sense?

On Wed, Sep 13, 2017 at 11:48:44PM -0400, Doug McIlroy wrote:
> > Check out:  ybc: a compiler for B <https://github.com/Leushenko/ybc>
>
> >From a historical standpoint, a plain B compiler lacks a very important
> attribute of B in Unix. Yes, B presaged some C syntax. But its shining
> property was that it produced threaded code, for which both compact
> and expanded runtime support was available. The latter had software
> paging. Thus B transcended the limited physical memory of the early
> PDP-11s.
>
> If you can't compile something, you can't run it.  A prime example was B
> itself. Without software paging it would not have been able to recompile
> itself, and Unix would not have been self-supporting.
>
> Doug

--
---
Larry McVoy                  lm at mcvoy.com             http://www.mcvoy.com/lm