From owner-freebsd-hackers Sun Feb 13 7:42:54 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from lamb.sas.com (lamb.sas.com [192.35.83.8]) by builder.freebsd.org (Postfix) with ESMTP id 099F441BD for ; Sun, 13 Feb 2000 07:42:51 -0800 (PST) Received: from mozart (mozart.unx.sas.com [192.58.184.28]) by lamb.sas.com (8.9.3/8.9.1) with SMTP id KAA17612; Sun, 13 Feb 2000 10:41:55 -0500 (EST) Received: from dean.pc.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA24691; Sun, 13 Feb 2000 10:41:25 -0500 Received: (from brdean@localhost) by dean.pc.sas.com (8.9.3/8.9.1) id KAA70378; Sun, 13 Feb 2000 10:41:25 -0500 (EST) (envelope-from brdean) From: Brian Dean Message-Id: <200002131541.KAA70378@dean.pc.sas.com> Subject: Re: Tuning up semaphores in kernel In-Reply-To: <00021314111301.00418@newbee.web2000.ru> from Andrey Novikov at "Feb 13, 2000 02:08:52 pm" To: Andrey Novikov Date: Sun, 13 Feb 2000 10:41:25 -0500 (EST) Cc: freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL61 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG SEMMNI is the number of semaphore ids, i.e., the number of times you can call 'semget()' without deleting any semaphores. SEMMNS is the actual number of semaphores in the system, which should be >= SEMMNI. Of course, you can ask 'semget()' to give you up to SEMMSL semaphores on each call, so SEMMNS should usually be larger than SEMMNI. Ideally, if you know the max number of semaphores that a program obtains via a semget call, set SEMMSL to that value. Then, if you know the max number of semid's that are in use at any given time, then set SEMMNI to that value. Then compute SEMMNS = SEMMNI*SEMMNS. This will guarantee you have enough, as long as your usage information is accurate. Personally, I would just bump up SEMMNI and SEMMNS by 20% (or whatever). Your documentation that came with your application should give you an idea of it's semaphore usage. Use that as the guide as to what to set these things to as a starting point. -Brian Andrey Novikov wrote: > > struct seminfo seminfo = { > > SEMMAP, /* # of entries in semaphore map */ > > SEMMNI, /* # of semaphore identifiers */ > > SEMMNS, /* # of semaphores in system */ > > SEMMNU, /* # of undo structures in system */ > > SEMMSL, /* max # of semaphores per id */ > > SEMOPM, /* max # of operations per semop call */ > > SEMUME, /* max # of undo entries per process */ > > SEMUSZ, /* size in bytes of undo structure */ > > SEMVMX, /* semaphore maximum value */ > > SEMAEM /* adjust on exit max value */ > > }; > > You probably want to increase either SEMMNI or SEMMNS. > > I've noticed that but why are they so "round"? Is there any corelation > between all these numbers? I don't want to break my kernel by guessing. > > > > options SEMMAP=31 > > > options SEMMNI=11 > > > options SEMMNS=61 > > > options SEMMNU=31 > > > options SEMMSL=61 > > > options SEMOPM=101 > > > options SEMUME=11 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message