Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 1998 02:30:17 -0500
From:      "Alfred Perlstein" <perlsta@sunyit.edu>
To:        "Chrisy Luke" <chrisy@flix.net>, "Tom" <tom@sdf.com>
Cc:        <joelh@gnu.org>, <freebsd-hackers@freebsd.org>
Subject:   Re: sharable static arrays?
Message-ID:  <199801130334.DAA28451@fang.cs.sunyit.edu>

next in thread | raw e-mail | index | archive | help
just an idea, wouldn't there be a way to tell the compiler to mark a
segement of data as program TEXT? That way when you fork() there's only one
copy, the origional.  this would also help protect against it being
corrupted if the segment was marked read only... ie seg fault

sorry i have no clue on how to do this though....

-Alfred

----------
> From: Chrisy Luke <chrisy@flix.net>
> To: Tom <tom@sdf.com>
> Cc: joelh@gnu.org; freebsd-hackers@FreeBSD.ORG
> Subject: Re: sharable static arrays?
> Date: Monday, January 12, 1998 2:40 PM
> 
> Tom wrote (on Jan 12):
> > 
> > On Mon, 12 Jan 1998, Chrisy Luke wrote:
> > 
> > > Joel Ray Holveck wrote (on Jan 12):
> > > > Are static arrays shared across multiple invocations of a program?
> > > 
> > > Not intrinsicly. You'll have to either use SYS-V style shared
> > > memory (options SYSVSHM SYSVSEM SYSVMSG in a kernel config and
> > > shmget(2) etc) or use BSD style mapped memory (mmap(2)).
> > 
> >   Remember these are _static_ arrays, which mean they are directly
coded
> 
> He said static, not const. There's a difference. Static data can be
> modified, it's just by inference hidden from higher scopes.
> 
> Static memory is shared (it's setup by the C startup module) in so far
> as the initial state is the same. Any changes will not be seen across
> multiple invokations. For that, you need shared memory of some nature.
> 
> In this case, of course, the area should be marked volatile... :-)
> 
> Chris.
> -- 
> == chris@easynet.net, chrisy@flix.net, chrisy@flirble.org.
> == Head of Systems for Easynet Group PLC.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801130334.DAA28451>