Subject: Re: NetBSD multi-threaded?
To: None <michaelv@HeadCandy.com, current-users@sun-lamp.cs.berkeley.edu>
From: Chris G. Demetriou <cgd@alpha.bostic.com>
List: current-users
Date: 09/12/1994 23:22:01
charles said:
>    Deep within the recesses of my foggy memory, I remember something
>    about the u. structures in kernel memory being changed to a
>    different format, [...]
> 
> In Net/2 and later, the struct user is now stored in a per-process
> location, not a fixed location for all processes.

Actually...  In Net/2 and later, each process has its own 'struct
user' location, but (at least as far as i'm aware) when a process is
curproc, its user struct is doubly-mapped to a constant address as
well.  That's definitely true of all the ports that i'm aware of (but
then, i'm not familiar with the low-level details of them all).

The reason for this is rather interesting: when you fork, you've gotta
copy the kernel stack.  the kernel stack typically lives at the 'high
end' of the UPAGES, and the per-process struct user lives at the low
end.  It's really a pain to have to re-thread the stack, so, by
remapping the UPAGES at a fixed address for all processes, and only
using the kernel stack in that mapping, a lot of hassle is avoided...

"just fyi."


chris