Two Programming Questions

Chris Gonnerman at tree.uucp
Wed Aug 29 14:46:08 AEST 1990


In article <1990Aug27.230044.13699 at virtech.uucp>, cpcahil at virtech.uucp (Conor P. Cahill) writes:
> In article <380 at icjapan.uucp> jimmy at denwa.info.com (Jim Gottlieb) writes:

[ stuff deleted ]

> >contents of a certain shared memory segment.  If not, I guess we can
> >always kludge around the problem by using the presence of a "lock" file
> >to indicate whether it is OK to write to that shared memory, or we can
> 
> Or you could use a semaphore 

[ text about alternate semaphore implementation deleted ]


I have a group of programs which must syncronize access to a pair of shared 
segments, and I am using message queues.  While message queues are not
suitable in all cases they seem much simpler when the sharing is on an
"in turn" basis... that is, one program writes the segment, then sends a
message to the next program which may write the segment, etc.  You can
even do a sort of "token ring" implementation, although my code uses
another setup.

It really depends on what you are doing with the segments.  Probably
your best bet is semaphores, but you need to examine all the
possibilities.

-- 
 +----------------------------------------------------------------------------+
 | Chris Gonnerman (Mad Programmer At Large)   csusac.ecs.csus.edu!tree!jcg   |
 | @ the Tree BBS, Sacramento, CA              ucbvax!ucdavis!csusac!tree!jcg |
 +----------  DISCLAIMER: These opinions are mine... MINE, I say!  -----------+



More information about the Comp.unix.i386 mailing list