[PLUG] Message Passing C.

michael michael at robinson-west.com
Mon Nov 27 17:00:57 UTC 2017


I have two C programs.  Program A tries to lock a PNG file and then 
writes it out.  Program B, if it starts before A, will lock the not 
ready PNG file blocking A and will seg fault on trying to read it.  Both 
programs are serially executed C programs.  I figure a better approach 
is message passing between the two programs instead of system level file 
locking or in addition to file locking.  I can have a dedicated thread 
in each program that handles the communication perhaps.  I'm trying to 
get program B to refrain from locking the PNG file until program A says 
that that file is ready.  Program A will
overwrite the PNG file occasionally, so B needs to back off frequently 
over time.  The current programs get into what is called a race if B 
starts before A.  B has to die in that event, or seg fault, before A can 
get the proper lock.  Seg faults take time where the application is 
somewhat time sensitive.  If MPI for C is meant for parallel programming 
and is not suitable for the problem I have, I need to know that.  I 
don't have any examples of two separate C programs using MPI to 
communicate between each other about a shared resource.



More information about the PLUG mailing list