Data sending between master process and slaves

440 views Asked by At

I would need to send a pretty large amount (logs) amount of data from multiple processes to one master processes. They are all running independent on the system.

What would be the best way to do this? Is interprocess communication a good way to do that or should I use shared memory? Maybe there is a different way I don't know yet.

The language used is C on Linux, because I have to implement it in a existing program.

How would you accomplish it?

2

There are 2 answers

0
cruxion effux On BEST ANSWER

Apart from Inter process communication using pipes/named pipe See this SO question and shared memory See this SO question and So question for fastest and large size data discussion .(It directs on using shared memory(fast and large) and pipes(easy).

You can try using Sockets. Where master listens on a port and all slaves connect to that port and master accepts connection.But this may lead to packeting and resource overhead.

2
Viswesn On

If its is unidirectional then I would recommend you to go for pipe; simple and straight forward.

If it is bi-directional then I would suggest you to go for socket programming rather than going for other inter process communication; The reason is "you end up writing locking mechanisms"; With socket you don't need to deal with those and more over your life will be easier in terms of coding.