[LCP] Questions regarding message queue
Ludwig Isaac Lim
ludz_lim at yahoo.com
Mon Jul 23 04:45:48 UTC 2007
Hi:
I have 2 questions regarding message queue IPCs:
1) What is the standard way of generating a queue id? I
usually do the following:
key = ftok(<name of the executable file>,..);
id = msgget(key,...);
I can see problems arising when I move the executable
to another directory.
Does a better alternative exist? Is the code below much
better
touch(<name of a temporary file>);
key = ftok(<name of the temporary file>):
since "touch" was called prior to ftok, then mostly
likely, calls to ftok will always be successfull.
Supposing somebody deletes the temporary file AFTER the
message queue has been created. Will it affect the message
queue?
2) Is message queue always a better alternative to FIFO?
The only foreseable problem with message queues if the
message size larger than msgmax. When is FIFO preferred
over message queues? It seems that FIFO is much better is
the message size is very large. Any other opinion?
Thanks in advance,
ludwig lim
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
More information about the linuxCprogramming
mailing list