home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / hp / 8405 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.9 KB

  1. 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
  2. From: good@gdwest.gd.com (David L. Good)
  3. Newsgroups: comp.sys.hp
  4. Subject: Re: Shared memory in 6.5
  5. Message-ID: <1992Jul22.225344.13118@gdwest.gd.com>
  6. Date: 22 Jul 92 22:53:44 GMT
  7. References: <1992Jul16.140923.16870@bmers145.bnr.ca> <7371155@hpfcso.FC.HP.COM> <1992Jul21.150922.17048@bmers145.bnr.ca>
  8. Organization: General Dynamics Corp.
  9. Lines: 27
  10.  
  11. In article <1992Jul21.150922.17048@bmers145.bnr.ca> jasonc@bnr.ca (Jason Chen) writes:
  12. >
  13. >Basically, I want to create a pair of client-server processes in where
  14. >the server gets a shared memory segment and puts its pid in the segment,
  15. >and the client gets the server pid and determines whethere the server is
  16. >still running.  The reason I want the segment to be remove when shm_nattck
  17. >equals zero is that the client can use this (shmget() failure) to determine
  18. >the existence of the server.  As we all know that some signals can not be
  19. >caught, and the pid could be reused by another process (it may take a
  20. >long time, but ...).  I know that there are many other ways to do this
  21. >e.g. using shmctl(IPC_STAT) to get shm_nattck, or using file with flock().
  22. >We have decided to used file instead of shared memory.  I did learn some
  23. >thing about shared memory.
  24. >
  25. >Jason
  26. >
  27.  
  28. If all you need is to know whether the server is running or not,
  29. you might consider using semaphores.  But, if you really need to be
  30. able to pass the pid (maybe for some more complicated  processing),
  31. semaphores won't quite do the job.  Also, like shared memory, semaphore
  32. sets will stick around after the server dies if it dies unexpectedly or
  33. gets killed in an "unfriendly" (i.e. "kill -9 ...") fashion.
  34. -- 
  35. David Good                                               good@gdwest.gd.com
  36.  
  37.                  This space intentionally left blank.
  38.