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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ?
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 ?
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.
/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.