Subject: Re: savecore_flags="-z"
To: Andrew Brown <atatat@atatdot.net>
From: Greywolf <greywolf@starwolf.com>
List: tech-kern
Date: 12/03/1999 22:37:10
On Thu, 2 Dec 1999, Andrew Brown wrote:

# >However, there can be more than one process on the machine (and there
# >normally _is_ with NetBSD :-)).  And the combined virtual address spaces
# >of all process may well exceed 4GB.
# 
# this i still don't get, unfortunately most of the experience i have on
# paging is "book lernin'"...not much in the way of practical
# experience.  if i split a faulted memory access into (according to my
# (probably failing) memory) a page table number, a page number, and an
# offset within that page...how can i recombine those numbers in some
# way (through lookups or what-not) to come up with a number that's
# *greater* than 32 bits?  or do we cheat and use bits from the pid or
# something...?

foot = open((*greywolf)->mouth, O_RDWR|O_EXCL);	/*I'm sure I'll regret this*/

You're still thinking on physical pages.  You can map more than one virtual
page to a physical page by way of contexts.  For example:

You have 4GB physmem plus 8GB swap(!).

pid 22499 has decided to take up all available physmem, say it's 2.5GB
(busy machine), but hasn't been paged.  Now it forks and gets pid 22500.

pid 22499 gets paged out bit by bit as 22500 becomes active.  You now have
effectively used up 5GB of space.

As 22500 runs, parts of it may get paged out of physical memory due to
normal system activity.  The RSS may decrease(!) to 1.2GB, but its VSZ
will still be 2.5GB (or something approximating that -- suffice to say
it will be some large positive number, for you kernel nitpickers out
there :-).

PID 22499 has a different context than PID 22500.

The system will, of course, thrash, if both of them decide to be horribly
active at the same time, being that both of them cannot occupy that
much physical memory at the same time.

Now imagine this happening several times over to the limit of physmem
+ swap, for (physmem = (4GB - kernel overhead and system processes),
swap = N * physmem).  At this point you have much more than 4GB of
space to deal with, because you have 1+GB per process in virtual space.

Is this at all any more clear?

# 
# -- 
# |-----< "CODE WARRIOR" >-----|
# codewarrior@daemon.org             * "ah!  i see you have the internet
# twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
# andrew@crossbar.com       * "information is power -- share the wealth."
# 


				--*greywolf;
--
NetBSD: a devil of an operating system.