From owner-freebsd-hackers Tue Jan 13 20:35:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA13222 for hackers-outgoing; Tue, 13 Jan 1998 20:35:30 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from wcc.wcc.net (wcc.wcc.net [208.6.232.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA12081 for ; Tue, 13 Jan 1998 20:30:13 -0800 (PST) (envelope-from piquan@wcc.wcc.net) Received: from detlev.UUCP (tnt167.wcc.net [208.10.139.167]) by wcc.wcc.net (8.8.7/8.8.7) with ESMTP id WAA21377 for ; Tue, 13 Jan 1998 22:27:00 -0600 (CST) Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.7) id WAA03879; Tue, 13 Jan 1998 22:30:18 -0600 (CST) (envelope-from joelh) Date: Tue, 13 Jan 1998 22:30:18 -0600 (CST) Message-Id: <199801140430.WAA03879@detlev.UUCP> To: freebsd-hackers@FreeBSD.ORG In-reply-to: <19980112194053.29382@flix.net> (message from Chrisy Luke on Mon, 12 Jan 1998 19:40:53 +0000) Subject: Re: sharable static arrays? From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <19980112112455.48744@flix.net> <19980112194053.29382@flix.net> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk >>>> 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. My apologies, I was meaning 'static' as opposed to 'dynamic'. I should have said 'const'. > 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. So it's originally mapped in as shared, but copy-on-write, then? Does this only apply to vars declared static, or does it also apply to global vars not declared static? > In this case, of course, the area should be marked volatile... :-) Some might argue that several of my entire programs should be marked volatile... :-) Thanks, joelh -- Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan Fourth law of programming: Anything that can go wrong wi sendmail: segmentation violation - core dumped