Send Data to Multiple Processes in Linux [closed] Send Data to Multiple Processes in Linux [closed] unix unix

Send Data to Multiple Processes in Linux [closed]


Have you looked at zeroMQ? It is a lightweight messaging library that supports various push/pull access patterns over several transport mechanisms.


One option is to write flat files or SQLite database on the same box.

And have another control file with a process shared mutex, condition variable and record count mapped into memory of the publisher and subscribers. This is the notification mechanism.

This way you would have full history of records in the file or the database which makes it easy to replay records, debug and recover subscribers from crashes.

The publisher would:

  1. Map the control file into memory.
  2. Add new records to the file or the database.
  3. Lock the mutex.
  4. Update the record count.
  5. notify_all on the condition variable.
  6. Unlock the mutex.

The subscribers would:

  1. Map the control file into memory.
  2. Lock the mutex.
  3. Wait on the condition variable till there are new records (each subscriber maintains its own count of already processed records).
  4. Unlock the mutex.
  5. Process the new records from the file or the database.