Date: Mon, 12 Jan 1998 23:39:22 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: chrisy@flix.net (Chrisy Luke) Cc: joelh@gnu.org, freebsd-hackers@FreeBSD.ORG Subject: Re: sharable static arrays? Message-ID: <199801122339.QAA23345@usr08.primenet.com> In-Reply-To: <19980112112455.48744@flix.net> from "Chrisy Luke" at Jan 12, 98 11:24:55 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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)). They will be shared if your compiler puts them in your text section instead of putting them in your data section. Supposedly, GCC supports this. Actually, -fwritable-strings defeats placing static strings into your text segment (which is mapped read-only). Ideally, all static data should be mapped copy-on-write. I don't think it's mapped, at this point; it probably needs a seperate ELF section from the rest of data, to (1) force it to a page boundry for it's mapping and (2) allow it to have seperate section flags to indicate it should be treated as copy-on-write. So it's "yes, if you do it right" and "no, but probable in the not so near future if you don't do it right". Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801122339.QAA23345>