Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Shared read-only memory documented anywhere?
@ 1995-07-19  4:00 Tim Bray
  0 siblings, 0 replies; only message in thread
From: Tim Bray @ 1995-07-19  4:00 UTC (permalink / raw)


Hi; I'd be delighted with an RTFM pointing at a FAQ or a place in the docs.

I have a program that (a) loads up a bunch of in-memory data structures, 
and then (b) repeatedly forks and does things in the child process, 
accessing the data structures read-only.  (It's a modified httpd, for those
who know about such things).  My alpha is spending too much time in system
mode, and I suspect these structures.  So this leads to the questions:

(1) after a fork(), is OSF doing a copy-on-ref or a copy-on-write of these 
    things?

(2) In the case where it's doing a copy-on-ref (which I *don't* want/need), 
    would putting the stuff in a buffer defined as follows allow child
    processes to access it without copying?  And (for people who are *really*
    in the know) would this make any difference?

    buf = mmap(NULL, as_much_room_as_I_need,
            PROT_READ|PROT_WRITE, 
            MAP_ANONYMOUS|MAP_VARIABLE|MAP_SHARED,
            -1, 0);
    /* copy it in */
    /* make it read-only; we hope that this won't get copied on fork() */
    mprotect(buf, as_much_room_as_I_need, PROT_READ);

I kind of doubt that the answer is of general interest; if you 
agree, email me; or post if you think anyone cares.

Thanks in advance,
Tim Bray, Open Text Corporation (tbray@opentext.com)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-07-19  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-19  4:00 Shared read-only memory documented anywhere? Tim Bray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox