[TUHS] Memory management in Dennis Ritchie's C Compiler

Dan Cross crossd at gmail.com
Tue Aug 25 03:20:43 AEST 2020


On Mon, Aug 24, 2020 at 1:08 PM John Cowan <cowan at ccil.org> wrote:

> On Mon, Aug 24, 2020 at 12:00 PM Dan Cross <crossd at gmail.com> wrote:
>
>> Stacks may be at the top of the user portion of the address space; but
>> I'd have to double check the details.
>>
>
> That's always true on the PDP-11 and Vax, no matter what the OS, because
> the processor architecture (which has pre-increment and post-decrement
> instructions, but not their counterparts) makes anything but a
> downward-growing stack unmanageable.
>

Ah, but if one has a fixed-size stack that cannot be extended, one can put
it anywhere one wants in the virtual address space. E.g., right after the
program text segment or whatever (effectively using the text as a guard to
detect stack overflow). I don't know why one would want to do that, except
that it makes freeing the virtual address space slightly simpler when the
process exits, but the point is that the Unix choice isn't the only way.
That said, stacks and data growing toward each gives the maximum amount of
flexibility.

In OSes without virtual memory like RSX-11[ABC], RT-11, and
> mini-Unix/LSX-11, what counts as the top naturally varies.
>
> Dennis's compiler AFAIK was never extended to anything but the PDP-11,
> both as host and target.
>

That's my impression, as well.

        - Dan C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200824/febc4dfa/attachment.htm>


More information about the TUHS mailing list