posix_mq RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: ruby.posix.mq@librelist.com
Subject: Re: Calculating the required value of "ulimit -q"
Date: Thu, 14 Jan 2010 23:57:00 +0100	[thread overview]
Message-ID: <201001142357.00901.ibc@aliax.net> (raw)
In-Reply-To: 20100114225518.GA18982@dcvr.yhbt.net

El Jueves, 14 de Enero de 2010, Eric Wong escribió:
> Iñaki Baz Castillo <ibc@aliax.net> wrote:
> > Hi, I create a mqueue with msgsize 1024 and maxmsg 5000, so in total:
> >
> >   5120000 bytes
> >
> > I set for root that value:
> >
> >   ~# ulimit -q 5120000
> >
> > However I get Errno::ENOMEM. In order it to work I must increase the
> > ulimit to a value closed to 5160000.
> >
> > Could I know which is the exact algorithm to calculate the required
> > "ulimit - q" value based on the desired msgsize and maxmsg?
> > I would like my application to suggest that value if it cannot start due
> > to memory limitations when creating the mqueue.
> 
> Hi Iñaki,
> 
> Under Linux, "man 2 getrlimit" says this:
> 
>   RLIMIT_MSGQUEUE (Since Linux 2.6.8)
>         Specifies the limit on the number of bytes that can be allocated
>         for POSIX message queues for the real user  ID  of  the  calling
>         process.	 This  limit is enforced for mq_open(3).  Each message
>         queue that the user creates counts (until it is removed) against
>         this limit according to the formula:
> 
>         bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +
>                 attr.mq_maxmsg * attr.mq_msgsize
> 
>         where  attr  is  the  mq_attr  structure specified as the fourth
>         argument to mq_open(3).
> 
>         The first addend in the formula,	which  includes  sizeof(struct
>         msg_msg *) (4 bytes on Linux/i386), ensures that the user cannot
>         create an unlimited number of zero-length  messages  (such  mes
>         sages nevertheless each consume some system memory for bookkeep
>         ing overhead).

Great, I was looking in the wrong place :)


> I'm not sure about other OSes (info/research/experiences would be
> greatly appreciated!).

Unfortunatelly I just use Linux :)
 
Thanks a lot.

-- 
Iñaki Baz Castillo <ibc@aliax.net>

  reply	other threads:[~2010-01-14 22:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 22:33 Calculating the required value of "ulimit -q" Iñaki Baz Castillo
2010-01-14 22:55 ` Eric Wong
2010-01-14 22:57   ` Iñaki Baz Castillo [this message]
2010-01-14 23:01     ` Iñaki Baz Castillo
2010-01-15 10:01       ` Iñaki Baz Castillo
2010-01-15 18:33         ` Iñaki Baz Castillo
2010-01-15 20:15         ` Eric Wong
2010-01-15 21:27           ` Iñaki Baz Castillo
2010-01-15 22:12             ` Eric Wong
2010-01-15 23:41               ` Iñaki Baz Castillo
2010-01-16  1:02                 ` Eric Wong
2010-01-16 13:08                   ` Iñaki Baz Castillo
2010-01-18 11:35                     ` Eric Wong
2010-01-18 12:05                       ` Iñaki Baz Castillo
2010-01-18 15:42                         ` Iñaki Baz Castillo
2010-01-18 15:55                           ` Iñaki Baz Castillo
2010-01-19  2:59                             ` Eric Wong
2010-01-19  9:29                               ` Iñaki Baz Castillo
2010-01-18 16:09                         ` Iñaki Baz Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/ruby_posix_mq/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201001142357.00901.ibc@aliax.net \
    --to=ibc@aliax.net \
    --cc=ruby.posix.mq@librelist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_posix_mq.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).