Subject: Re: CVS commit: src/sys
To: Christos Zoulas <christos@zoulas.com>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-userlevel
Date: 06/24/2007 22:19:44
On Sun, Jun 24, 2007 at 10:13:16PM -0400, Christos Zoulas wrote:
> 
> It would be nice if someone implemented a commpage for NetBSD and stuffed all
> this info there.

This isn't what would go in the traditional "commpage" which is common
between *all* user processes and the kernel, because (for example) the result
of getpid() is specific to *each process*.  The result of getpid() belongs
in a local variable in each process, I believe, reset at fork() time in
each child.

We could implement two "commpages" per process: one shared between the kernel
and *all* processes (for gettimeofday(), cpu-optimized memcpy() etc, and that
sort of thing) and another shared between the kernel and *each* process (for
getpid(), getppid(), and so forth) but why pay the penalty of accessing a
shared page if you don't have to?

Perhaps this would be a reasonably elegant way to handle getppid() without
any kind of asynchronous notification to the process, though.  But for
getpid() a local variable will do -- unless you see some reason why it
won't?

-- 
Thor Lancelot Simon	                               tls@rek.tjls.com
  "All of my opinions are consistent, but I cannot present them all
   at once."	-Jean-Jacques Rousseau, On The Social Contract