From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f72b0,db9f775c28e31eb6 X-Google-Attributes: gidf72b0,public X-Google-Thread: fe1d2,db9f775c28e31eb6 X-Google-Attributes: gidfe1d2,public X-Google-Thread: f678f,db9f775c28e31eb6 X-Google-Attributes: gidf678f,public X-Google-Thread: 115614,db9f775c28e31eb6 X-Google-Attributes: gid115614,public From: jum@helios.de (Jens-Uwe Mager) Subject: Re: fork() with copy-on-write? Date: 1996/03/28 Message-ID: #1/1 X-Deja-AN: 144735809 sender: news@baghira.han.de (news at baghira.han.de) references: <1996Mar19.160747.116289@kuhub.cc.ukans.edu> <4is3hq$fj1@microl4.microlise.UUCP> <4j8414$smu@garotte.va.pubnix.com> <4j9bqr$q1h@microl4.microlise.UUCP> <4jc6gf$3j1@bayonne.netapp.com> organization: HELIOS Software GmbH newsgroups: comp.unix.aix,comp.unix.misc,comp.unix.osf.misc,comp.unix.sco.misc 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