raghu@timbaktu.osc.edu (Raghu) (10/08/89)
Two questions about message queues in UNIX:
1. I have a problem withe following piece of code. I am trying to use the
message queue facility in UNIX and I have come across a strange problem.
The constant KERNEL_PORT is 2401 and the getuid call returns 104 (my uid on
our SUNS). Then, with a key of 2505 the call msgget blow out with the
message "Permission Denied". That should not happen as I set the msgflag to
reflect that (0000600). Has anyone else seen this problem or aware of this
problem...
/* if ((myqid = msgget((key_t) (KERNEL_PORT + getuid()), IPC_CREAT|0000600)) */
if ((myqid = msgget((key_t) getuid(),IPC_CREAT|0000600))
== ERROR) {
perror("kernel (msgget)");
exit(errno);
}
2. I am exploring the use of message queues instead of the traditional
socket IPC operations. The application involves a daemon-like program to
rendezvous two other processes and I want to use the message queue facility
to make synchronization possible. I am interesting in evaluating on how
much faster it would be to go this way. Gut feeling indicates that message
queues could be faster than passing UDP packets around and this might be
because the UNIX kernel supports this facility better (and probably uses it).
Any ideas or comments !!
Raghu
nick@toro.UUCP (Nicholas Jacobs) (10/15/89)
>Two questions about message queues in UNIX: > >our SUNS). Then, with a key of 2505 the call msgget blow out with the >message "Permission Denied". That should not happen as I set the msgflag to >reflect that (0000600). Has anyone else seen this problem or aware of this > Question for you: does the message queue already exist? If it does with 0600 permission and you are not the owner, you will not be allowed to connect to it. >2. I am exploring the use of message queues instead of the traditional >socket IPC operations. The application involves a daemon-like program to >rendezvous two other processes and I want to use the message queue facility >to make synchronization possible. I am interesting in evaluating on how >much faster it would be to go this way. Gut feeling indicates that message >queues could be faster than passing UDP packets around and this might be >because the UNIX kernel supports this facility better (and probably uses it). > >Any ideas or comments !! > >Raghu The only advantage you really get with SysV message queues is speed and even that is questionable in most applications (i.e., the speed of memory based message queues does not really affect your application much). The disadvantages are considerable. The first is that they are limited to only the machine you are running on, thus removing any possibility of transparent network extensions. Also, since they do not map into the file system domain they are not selectable, thus you have no asynchronous notification available. We use message queues heavily since this is a SysV based project, but given a choice I would use sockets rather than message queues. Nicholas Jacobs UUCP: ...!uunet!toro!nick Internet: toro!nick@uunet.uu.net AT&T: (212) 236-3230
john@baldur.UUCP (John Brinegar) (12/27/90)
Following is an request I am posting for a friend that doesn't have net access. Please respond to the voice phone number given at the end of the article. --------------------------------------------------------------------------- I am wondering if anyone has source to help me with a problem I have encountered in a project I am working on. I am using System V (Venix) and need more messages outstanding in the message queues than apparently the system will alow. According to what I decypher from mtune, I can only have 40 messages outstanding systemwide. But the biggest limitation is the 128K limitation due to the way message queues are implemented. Essentially, my requirements are as follows: Message length max = 512 (may get by with 256 bytes) 40 queues Max # of outstanding messages = 500 Different queues may have different max message lengths. The messages need to be accessed randomly. (Not FIFO) What I am hoping for is that someone has developed the code implementing message queues in shared memory. I can be reached at (daytime, voice) phone # (303) 939-6922 Robert Payne --------------------------------------------------------------------------- -- John D. Brinegar {att!uswat, uunet!dunike} !onecom!john TelWatch Inc. (303) 440-4756