home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!natinst.com!news.dell.com!swrinde!mips!zaphod.mps.ohio-state.edu!sdd.hp.com!caen!sol.ctr.columbia.edu!ucselx!gdwest!good
- From: good@gdwest.gd.com (David L. Good)
- Newsgroups: comp.sys.hp
- Subject: Re: Shared memory in 6.5
- Message-ID: <1992Jul22.225344.13118@gdwest.gd.com>
- Date: 22 Jul 92 22:53:44 GMT
- References: <1992Jul16.140923.16870@bmers145.bnr.ca> <7371155@hpfcso.FC.HP.COM> <1992Jul21.150922.17048@bmers145.bnr.ca>
- Organization: General Dynamics Corp.
- Lines: 27
-
- In article <1992Jul21.150922.17048@bmers145.bnr.ca> jasonc@bnr.ca (Jason Chen) writes:
- >
- >Basically, I want to create a pair of client-server processes in where
- >the server gets a shared memory segment and puts its pid in the segment,
- >and the client gets the server pid and determines whethere the server is
- >still running. The reason I want the segment to be remove when shm_nattck
- >equals zero is that the client can use this (shmget() failure) to determine
- >the existence of the server. As we all know that some signals can not be
- >caught, and the pid could be reused by another process (it may take a
- >long time, but ...). I know that there are many other ways to do this
- >e.g. using shmctl(IPC_STAT) to get shm_nattck, or using file with flock().
- >We have decided to used file instead of shared memory. I did learn some
- >thing about shared memory.
- >
- >Jason
- >
-
- If all you need is to know whether the server is running or not,
- you might consider using semaphores. But, if you really need to be
- able to pass the pid (maybe for some more complicated processing),
- semaphores won't quite do the job. Also, like shared memory, semaphore
- sets will stick around after the server dies if it dies unexpectedly or
- gets killed in an "unfriendly" (i.e. "kill -9 ...") fashion.
- --
- David Good good@gdwest.gd.com
-
- This space intentionally left blank.
-