LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 08-03-2006, 11:27 AM   #1
aral
Member
 
Registered: Aug 2005
Posts: 115

Rep: Reputation: 15
inter process communication


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 ?
 
Old 08-03-2006, 12:08 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
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.
 
Old 08-03-2006, 12:22 PM   #3
aral
Member
 
Registered: Aug 2005
Posts: 115

Original Poster
Rep: Reputation: 15
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 ?
 
Old 08-03-2006, 12:36 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
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.
 
Old 08-03-2006, 01:25 PM   #5
aral
Member
 
Registered: Aug 2005
Posts: 115

Original Poster
Rep: Reputation: 15
I thought we weren't suppose to use /dev/shm cause it's used for virtual memory .. . nop ?
 
Old 08-03-2006, 01:37 PM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
/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.
 
  


Reply



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
Monitor inter process communication across ports chtaylo3 Programming 0 07-12-2006 03:28 PM
inter module communication misbahuddin Programming 1 01-04-2006 01:42 AM
how to do one to many inter process communication? Thinking Programming 2 12-14-2005 03:54 AM
inter-program communication Raspis21 Programming 9 07-22-2005 02:49 AM
Need a challange?!? Try to solve this one: INTER PROCES COMMUNICATION rkrijger Linux - Software 1 10-29-2003 09:43 AM

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

All times are GMT -5. The time now is 08:21 PM.

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