From owner-freebsd-hackers Tue Dec 10 11:08:20 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id LAA22432 for hackers-outgoing; Tue, 10 Dec 1996 11:08:20 -0800 (PST) Received: from zwei.siemens.at (zwei.siemens.at [193.81.246.12]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id LAA22347 for ; Tue, 10 Dec 1996 11:06:49 -0800 (PST) Received: from sol1.gud.siemens.co.at (root@[10.1.143.100]) by zwei.siemens.at (8.7.5/8.7.3) with SMTP id UAA23586 for ; Tue, 10 Dec 1996 20:06:22 +0100 (MET) Received: from ws2301.gud.siemens.co.at by sol1.gud.siemens.co.at with smtp (Smail3.1.28.1 #7 for ) id m0vXXVN-0001zWC; Tue, 10 Dec 96 20:06 MET Received: by ws2301.gud.siemens.co.at (1.37.109.16/1.37) id AA193564746; Tue, 10 Dec 1996 20:05:46 +0100 From: "Hr.Ladavac" Message-Id: <199612101905.AA193564746@ws2301.gud.siemens.co.at> Subject: Re: Multiple Buffer allocation of Shared Memory To: scrappy@hub.org (Marc G. Fournier) Date: Tue, 10 Dec 1996 20:05:46 +0100 (MEZ) Cc: erich@lodgenet.com, hackers@freebsd.org In-Reply-To: from "Marc G. Fournier" at Dec 10, 96 01:20:06 pm X-Mailer: ELM [version 2.4 PL24 ME8a] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk E-mail message from Marc G. Fournier contained: > On Mon, 9 Dec 1996, Eric L. Hernes wrote: > > > "Marc G. Fournier" writes: > > > > > >Hi... > > > > > > Just starting to play with shared memory, and have hit a wall > > >that I don't know if its too be expected, or if I've screwed something > > >up... > > > > Shared memory is cool, SysV symantics for shared memory *suck*, if at all > > possible use mmap(). BSDi uses libc wrappers around mmap() for > > it's SysV shm stuff, but there's caveats... I'd like the wrappers, > > but have the real ones available too. > > > > Okay...maybe I'm missing something as far as mmap() is concerned, > but what I want to be able to do is allocated X bytes of memory to be > shared amongst several processes. After the memory is allocated, I will > *then* want to fill the memory (ie. with data read from a socket). > > From reading the mmap() man page (any good reference/textbooks that > I might want to pick up?), mmap() allocates and fills the memory space at > the same time, based on a previously opened, already existing, file (fd). mmap with MAP_SHARED will "propagate" the writes among all processes who map is as shared. You can map with MAP_ANON as well which ignores the contents of the fd (but you still have to have it opened; /dev/null comes in handy :) /Marino > > Is there something I'm missing? With shared memory, this isn't a > problem, or, at least, from what I've read, won't be a problem... > > > #ifndef SHMSEG > > #define SHMSEG 8 > > #endif > > > > you can only have 8 shm segments by default, you can override > > it with: `options "SHMSEG=32"' or something similar in your config file. > > I usually bump SHMSEG to 128 and SHMMAXPGS to 4096. > > > > Did this, got this: > > ----- > hub> ./client > No space left on device > cannot initialize shared memory buffer #29 > ----- > > At least I'm getting 28 buffers created now, instead of just > 8 :) > > Now, am I understanding what I've configured correctly? With > SHMSEG=128 and SHMMAXPGS=4096, I should be able to allocate up to 128 > pages of 4096k each? I actually set SHMSEG to 256, mind you...just in case. > > options SYSVSHM > options SYSVSEM > options SYSVMSG > options "SHMSEG=256" > options "SHMMAXPGS=4096" > > Marc G. Fournier scrappy@hub.org > Systems Administrator @ hub.org scrappy@freebsd.org > >