IPC with guaranteed delivery

Dieses Thema im Forum "C/C++" wurde erstellt von heck, 09.01.2007.

  1. heck

    heck Grünschnabel

    Dabei seit:
    09.01.2007
    Beiträge:
    7
    Zustimmungen:
    0
    Hey folks,
    i need communicate between 2 processes in a reliable manner. The information delivery has to be guarenteed. I thought about proc 2 sending a signal to proc 1 when information has being written to disc and wirte() has been verified (sync/flush). The IPC method for the data is named pipes.

    When proc1 simply writes the data to the named pipe, and the system crashes before proc2 could read it and persistently save it to disc the information is lost.

    So my solution to this is:

    proc1:
    has opened a phys. file, tmpfile; and a named pipe
    1. writes data to tmpfile on disc, verify write()
    2. writes the data to pipe
    3. waits for signal from proc 2

    proc2:
    has select or poll to the pipe
    1. writes data to disc on pipe change, verifiy write()
    2. sends signal to proc 1, meaning data is persistently saved.

    prioc1:
    4. emtpys tmpfile

    what do you think about this idea?
    Is the pipe necessary?
    Could i as well read the physical tmpfile from proc2 instead of double write from proc1 to phys. file AND pipe. Performance?

    If you have suggestions introducing completly different concepts, please consider that proc1 is an already written program and outputs the data to a physical file. I cant really change proc1, adding a sighandler and a sigsuspend along a tmpfile creation/ emptiyng and a double write are small changes, but already nearly to big for this process (testing). Regulatory reasons (risk).

    My question is also, isn't there anything like a named pipe with persistent buffer on disc, and with fast buffer im mem for the usual work. the persistent buffer is copied to membuffer on open(). So data which was written to pipe but not read before crash is not lost (if the crash was after succesfull write to disc pipe internal). The write() call to this kind of pipe should return when data is assuredly written to disc, so the user program can assume once returned from the write() call, data is now delivered, guaranteed.

    Sorry for the long story, but i hope you can help me along with this conceptual problem!

    Thanks in advance!
    Heck
     
  2. Anzeige

    Schau dir mal diese Kategorie an. Dort findest du bestimmt etwas.
    Registrieren bzw. einloggen, um diese und auch andere Anzeigen zu deaktivieren
Thema:

IPC with guaranteed delivery