Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C15124765CF for ; Wed, 14 Aug 2002 08:49:38 -0400 (EDT) Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by postgresql.org (Postfix) with ESMTP id BF7204765AC for ; Wed, 14 Aug 2002 08:49:31 -0400 (EDT) Received: from canoe.velocet.net (canoe210.velocet.net [216.138.240.43]) by sabre.velocet.net (Postfix) with ESMTP id 78FAA13819A; Wed, 14 Aug 2002 08:49:34 -0400 (EDT) Received: by canoe.velocet.net (Postfix, from userid 101) id DFB2A5679FD; Wed, 14 Aug 2002 08:49:33 -0400 (EDT) From: David Gilbert MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15706.20957.753062.582158@canoe.velocet.net> Date: Wed, 14 Aug 2002 08:49:33 -0400 To: Tom Lane Cc: David Gilbert , "Thomas O'Connell" , pgsql-admin@postgresql.org Subject: Re: performance tuning: shared_buffers, sort_mem; swap In-Reply-To: <4195.1029296149@sss.pgh.pa.us> References: <27214.1029257785@sss.pgh.pa.us> <1372.1029274016@sss.pgh.pa.us> <15705.36038.645823.820155@canoe.velocet.net> <4195.1029296149@sss.pgh.pa.us> X-Mailer: VM 7.07 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/180 X-Sequence-Number: 5295 >>>>> "Tom" == Tom Lane writes: Tom> David Gilbert writes: >> I don't often ask a question, but it's been bugging me for some >> time: is there any reason why PostgreSQL must use SysV shared >> memory? Coming from the BSD camp, I've often pondered why it >> doesn't use BSD-style shared memory (which is often easier to >> allocate in the BSD world). Tom> Well, I must say this is the first time I've heard of "BSD-style Tom> shared memory". What are the syscalls? How portable is it? Tom> Does it have the semantics we need (specifically, the ability to Tom> associate an ID with a shmem segment, and the ability to discover Tom> whether any other processes are attached to an existing shmem Tom> segment)? The canonical example is to mmap() a file multiply. BSD will guarentee this is shared memory. Of course, to address the concern that you really don't need a file, the MAP_ANON flag can be given (meaning that there is no file). With anonymous memory, you pass the file descriptor through your fork()'s. With non-anonymous memory, you can mmap() it multiply from different processes and get the same effect. With a glance at the man page, you'd have MAP_SHARED | MAP_ANON | MAP_NOSYNC | MAP_HASSEMAPHORE. One bonus of bsd shared memory (when anonymous) is that it dies with the process ... even in the worst case. Dave. -- ============================================================================ |David Gilbert, Velocet Communications. | Two things can only be | |Mail: dgilbert@velocet.net | equal if and only if they | |http://daveg.ca | are precisely opposite. | =========================================================GLO================