From: andrewg@microlise.co.uk (Andrew Gierth)
Subject: Re: fork() with copy-on-write?
Date: 1996/03/28 [thread overview]
Message-ID: <4jf18a$28f@microl4.microlise.UUCP> (raw)
In-Reply-To: 4jc6gf$3j1@bayonne.netapp.com
In <4jc6gf$3j1@bayonne.netapp.com>, guy@netapp.com (Guy Harris) writes:
>Furthermore, AIX, at least, supports shared memory and shared libraries
>and shared text on RS/6000's with inverted page tables; it *is* possible
>to have a page mapped to multiple addresses - the trick, as I remember,
>is that a 32-bit per-process virtual address has the upper few bits
>select a segment register, and some stuff in the segment register and
>the rest of the 32-bit virtual address are concatenated to make a
>>32-bit *global* virtual address. A shared page has, I think, only one
>such global virtual address, but appears in more than one per-process
>32-bit address space.
Essentially correct, but not entirely complete...
Shared stuff on the RS is divided into 2 categories, shared *segments*
and shared *pages*. Segments are shared in the manner you describe, by
pointing at them from the segment registers of multiple processes;
that's easy.
The kernel segment, kernel extension segment, shared library segment,
program text segments, shared memory segments, files mapped with
shmat() (an AIX-ism), are all handled like this. That gives rise to the
(sometimes annoying) restriction (10, IIRC) on the number of attached
shared memory segments; there are only 16 segment registers...
[Another AIX-oddity is that _all_ open files are actually handled as
mapped memory segments, they just aren't made addressable to the user
process unless it calls shmat() on the file descriptor.]
Shared pages are more difficult; if you aren't sharing the whole
segment [eg. for fork() or mmap()], then as I understand it, the method
used is to switch the physical page between the referencing segments
as needed. So a (fast) page fault is taken on the page every time it
is referenced by a different segment. [This is documented for mmap();
mmap'ed pages are shared thus between a private segment and the real
shared segment that maps the file.]
But in the fork() case, then at some point the page must be copied,
rather than just twiddling it around; I would be interested to know
whether this is on the first reference, the first write, or some
other scheme. Perhaps a real AIX-wizard could enlighten us?
[disclaimer: the above is all either deduction or from published IBM
documentation; I have no access to the innards of AIX...]
-- Andrew (andrewg@microlise.co.uk)
[.sig under construction]
next prev parent reply other threads:[~1996-03-28 5:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-03-19 5:00 fork() with copy-on-write? anh
1996-03-20 5:00 ` Jim Sullivan's Home Account
1996-03-20 5:00 ` Yan-Song Chen
1996-03-21 5:00 ` Andrew Gierth
1996-03-26 5:00 ` Josh M. Osborne
1996-03-26 5:00 ` Andrew Gierth
1996-03-27 5:00 ` Guy Harris
1996-03-28 5:00 ` Jens-Uwe Mager
1996-03-28 5:00 ` Andrew Gierth [this message]
1996-03-22 5:00 ` Peter Shenkin
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox