LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2010, 01:45 AM   #1
aryan1
Member
 
Registered: Jul 2009
Posts: 50

Rep: Reputation: 16
Question theoretical limit on message queue sizes


Hi All,

Following function obtains the system-maintained structure for a message queue:

Code:
bool getMessageQueueStats(int mqId, struct msqid_ds* buf)
{
    if(msgctl(mqId, IPC_STAT, buf) == -1)
    {
        return false;
    }

    return true;
}
And following function simply resizes a message queue to a user-defined value, namely, "size":

Code:
bool resizeMessageQueue(int mqId, struct msqid_ds* buf, int size)
{
    /* Modify the message queue features */
    buf->msg_perm.uid = geteuid();
    buf->msg_perm.gid = getegid();
    buf->msg_perm.mode = 0660;
    buf->msg_qbytes = size; // The new size for the message queue

    if(msgctl(mqId, IPC_SET, buf) == -1)
    {
        return false;
    }

    return true;
}
My question is if there is a theoretical limit on user-defined message queue sizes.

To put in other words, is it possible to increase the default message queue size to any user-defined value as long as that certain value does not exceed the size of system's physical memory ?

By the way, I use 64-bit Ubuntu 9.04.

Thanks.
 
Old 06-04-2010, 03:45 AM   #2
mac.tieu
Member
 
Registered: Jan 2010
Location: Vietnam
Distribution: Arch
Posts: 65

Rep: Reputation: 22
Quote:
Originally Posted by aryan1 View Post
Hi All,

Following function obtains the system-maintained structure for a message queue:

Code:
bool getMessageQueueStats(int mqId, struct msqid_ds* buf)
{
    if(msgctl(mqId, IPC_STAT, buf) == -1)
    {
        return false;
    }

    return true;
}
And following function simply resizes a message queue to a user-defined value, namely, "size":

Code:
bool resizeMessageQueue(int mqId, struct msqid_ds* buf, int size)
{
    /* Modify the message queue features */
    buf->msg_perm.uid = geteuid();
    buf->msg_perm.gid = getegid();
    buf->msg_perm.mode = 0660;
    buf->msg_qbytes = size; // The new size for the message queue

    if(msgctl(mqId, IPC_SET, buf) == -1)
    {
        return false;
    }

    return true;
}
My question is if there is a theoretical limit on user-defined message queue sizes.

To put in other words, is it possible to increase the default message queue size to any user-defined value as long as that certain value does not exceed the size of system's physical memory ?

By the way, I use 64-bit Ubuntu 9.04.

Thanks.
As msg_qbytes definition:
Code:
ushort msg_qbytes
Message queue size was limited to 1024*64 bytes

Cheers,
MT

Last edited by mac.tieu; 06-04-2010 at 03:51 AM.
 
Old 06-05-2010, 02:47 AM   #3
ArthurSittler
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 124

Rep: Reputation: 31
info from Bovet & Cesati

I have not looked at the source, but Bovet & Cesati, in Understanding the Linux Kernel talk about the message queues.

Quote:
"To avoid resource exhaustion, there are some limits on the number of IPC message queue resources allowed (by default, 16), on the size of each message (by default, 8,192 bytes), and on the maximum total size of the messages in a queue (by default, 16,384 bytes). As usual, however, the system administrator can tune these values by writing into the /proc/sys/kernel/msgmni, /proc/sys/kernel/msgmnb, and /proc/sys/kernel/msgmax files, respectively."
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix Queue Time Limit carlosinfl Linux - Server 1 04-27-2010 10:08 AM
CUPS - Queue Limit sectioneight Linux - Software 4 06-10-2009 09:29 PM
Is it possible for me to write in front of queue in case of message queue? hemanthv414 Linux - Newbie 1 11-17-2008 04:40 PM
mail postfix queue file size limit exceeded gabsik Linux - Networking 4 03-07-2008 03:25 AM
samba limit on file sizes about 2GB adler321 Linux - Software 7 09-22-2004 07:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration