Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2000 10:41:25 -0500 (EST)
From:      Brian Dean <brdean@unx.sas.com>
To:        Andrey Novikov <novikov@webclub.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Tuning up semaphores in kernel
Message-ID:  <200002131541.KAA70378@dean.pc.sas.com>
In-Reply-To: <00021314111301.00418@newbee.web2000.ru> from Andrey Novikov at "Feb 13, 2000 02:08:52 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002131541.KAA70378>