0

I'm currently working on a project requiring a number of processes running under control of a "master" process, which receives remote commands via TCP and tells the child processes what to do (e.g.: what files they should act on, what processing operations they should perform).

I've come up with the following ideas to pass commands/configuration down to the child processes:

  • Signals (not powerful enough)
  • A binary protocol over sockets or pipes connecting each process to the master (reinvent the wheel).
  • RPC (maybe overkill)
  • CORBA (perhaps overkill)
  • DDS (totally overkill)

Any ideas/suggestions?

cyberguijarro
  • 715
  • 3
  • 9
  • 21
  • What language are implementing in? Using threads instead of processes may be simpler. Or shared memory depending on the language. – GinoA Dec 02 '10 at 18:56
  • you can also use files or http://en.wikipedia.org/wiki/Message_queue – Drakosha Dec 02 '10 at 19:07
  • The imlpementation goes will probably be in C++, although I'm considering to staty with the old good C. – cyberguijarro Dec 03 '10 at 05:51
  • Thanks for all the ideas guys, I'll take a deep look into each of them and upvote the one that finally suits me (it's a shame one can't upvote all answers). – cyberguijarro Dec 03 '10 at 05:52

5 Answers5

1

D-Bus

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

How about a text-protocol via pipes?

text-protocols are always better than binary protocols because they are easier to test, and easier testing generally means fewer bugs.

MarkR
  • 62,604
  • 14
  • 116
  • 151
0

You could also use message queues, or shared memory with semaphores.

You could also look into an Apache project called ActiveMQ which allows messages to be dispatched to subscription queues, etc. Its very powerful and flexible and there are C interfaces. Its ideal if you have many machines/networks to which you need to dispatch messages.

http://activemq.apache.org/

Missaka Wijekoon
  • 883
  • 7
  • 10
0

A lightweight message queue like beanstalkd or resque seems like the right level of complexity. Files with inotify could also work; inotify is designed as an event queue. You can try it with incrontab before baking it in. {xml,json}-rpc are (slightly) more complex, but also more standard, as they use http. However, the message queue metaphor is more appropriate than rpc for non-blocking interactions.

Tobu
  • 24,771
  • 4
  • 91
  • 98
0

The supervisord tool may be useful. This is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

keyser
  • 18,829
  • 16
  • 59
  • 101