Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!swrinde!ucsd!pacbell.com!pacbell!sactoh0!tree! From: @tree.uucp (Chris Gonnerman) Newsgroups: comp.unix.i386 Subject: Re: Two Programming Questions Summary: how about message queues? Keywords: Shared Memory Locking -- TTY Read w/ Timeout Message-ID: <1990Aug29.044608.6973@tree.uucp> Date: 29 Aug 90 04:46:08 GMT References: <380@icjapan.uucp> <1990Aug27.230044.13699@virtech.uucp> Organization: TREE BBS (916)349-0385 Sacramento, Ca Lines: 31 In article <1990Aug27.230044.13699@virtech.uucp>, cpcahil@virtech.uucp (Conor P. Cahill) writes: > In article <380@icjapan.uucp> jimmy@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! -----------+