Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: jum@helios.de (Jens-Uwe Mager)
Subject: Re: fork() with copy-on-write?
Date: 1996/03/28	[thread overview]
Message-ID: <jum-2803962105130001@mac-jum.helios.de> (raw)
In-Reply-To: 4jc6gf$3j1@bayonne.netapp.com

In article <4jc6gf$3j1@bayonne.netapp.com>, guy@netapp.com (Guy Harris) wrote:

> 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.

This works fine for the AIX way to do shared libraries and for shmat()
style shared memory. It simply makes sure that all virtual addresses are
the same by placing them in the global segment (side note: if you unload a
shared object you might still call functions in it as the global segment
is still available!).

But AIX has to go through hoops to be able to do mmap(). The following is
from the InfoExplorer database:

  The mmap subroutine provides a unique object address for each process that
  maps to an object.  The software accomplishes this by providing each process
  with a unique virtual address, known as an alias.  The shmat subroutine
  allows processes to share the addresses of the mapped objects.

  Because only one of the existing aliases for a given page in an object has a
  real address translation at any given time, only one of the mmap mappings can
  make a reference to that page without incurring a page fault.  Any reference
  to the page by a different mapping (and thus a different alias) results in a
  page fault that causes the existing real-address translation for the page to
  be invalidated.  As a result, a new translation must be established for it
  under a different alias.  Processes share pages by moving them between these
  different translations.

If one wants to access the same data with multiple processes one has to
use shmat() to avoid the fault overhead. But shmat() also has the limit of
10 mappings that can be done, as each mapping consumes one segment
register. So if you intend to map more than 10 files you will have to use
mmap() instead, which may be a problem performance wise.

The AIX global variable _system_configuration (available to any process)
has a structure member that looks promising:

        int virt_alias;         /* 1 if hardware aliasing is supported */

I hope that this one is true for some future model (it was zero for all
models I tried).

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Lavesstr. 80
30159 Hannover
Phone:        +49 511 36482-0
FAX:          +49 511 36482-69



  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 ` 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           ` Andrew Gierth
1996-03-28  5:00           ` Jens-Uwe Mager [this message]
1996-03-20  5:00 ` Jim Sullivan's Home Account
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