ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
What kind of inter process communication is best suited for several processes sending keep alive timeouts to a wathdog process ? Each keep alive timeout is composed of three fields: PID, Date&time, Sate of process. Are message queues suitable for something like that ?If not , what is best suited for something like that ? What should I use to send the keep alive messages ?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
You could use a sockets-based communication method. The advantage is that the processes can scale to multiple machines without having to change the code.
Alternatively, if the transaction rate is high (the timeout is in milliseconds), you may want to look at using a shared memory implementation instead.
What do you mean "scale to multiple machines" ? You mean .. if the watchdog process and also the processes which have to send keep alive timeouts are on diferent machines ? it's all on the same machine .. if that's what you meant ..
I don't need the transactions to be at miliseconds intervals .. , so what should I use ?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
Yes, if the watchdog process and the processes which have to send keep alive timeouts are on diferent machines. Sometimes when creating the software you know that the application will grow, and that will change the design choices.
If it's all on the same machine, you want a simple communication path, you can just use file I/O with /dev/shm. Alternatively, you can use SysV IPC. As mentioned earlier, sockets are very popular. The choice is up to you, and to the requirements of your application.
Last edited by macemoneta; 08-03-2006 at 12:39 PM.
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
/dev/shm uses virtual memory, it's not used for virtual memory (that's the function of page frames and swap). /dev/shm will go to swap if it is permitted to grow sufficiently large; it's just an in-memory filesystem - I/Os are converted to memory read/write. It is a shared memory communication area, convenient for IPC. I frequently use it even for scripts on laptops, to prevent spinning up the hard drive on I/O.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.