home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / hp / 8330 < prev    next >
Encoding:
Text File  |  1992-07-21  |  2.0 KB  |  45 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!utcsri!torn!cunews!nrcnet0!bnrgate!bmers145!bnr.ca!jasonc
  3. From: jasonc@bnr.ca (Jason Chen)
  4. Subject: Re: Shared memory in 6.5
  5. Message-ID: <1992Jul21.150922.17048@bmers145.bnr.ca>
  6. Sender: news@bmers145.bnr.ca
  7. Reply-To: jasonc@bnr.ca (Jason Chen)
  8. Organization: Bell-Northern Research Ltd.
  9. References: <1992Jul16.140923.16870@bmers145.bnr.ca> <7371155@hpfcso.FC.HP.COM>
  10. Date: Tue, 21 Jul 92 15:09:22 GMT
  11. Lines: 32
  12.  
  13. In article <7371155@hpfcso.FC.HP.COM>, rdg@hpfcso.FC.HP.COM (Rob Gardner) writes:
  14. |> I still don't understand your situation clearly. Even if multiple
  15. |> processes need to attach the segment, depending on your application,
  16. |> you can have the last process that needs to attach it call
  17. |> shmctl(IPC_RMID).  Sorry, but that's the best you can do; Shared
  18. |> memory segments are *meant* to stick around after processes die,
  19. |> and you must remove them explicitly.
  20.  
  21. Rob,
  22.  
  23.         Thanks again for the reply.  Here is what I tried to do:
  24. Basically, I want to create a pair of client-server processes in where
  25. the server gets a shared memory segment and puts its pid in the segment,
  26. and the client gets the server pid and determines whethere the server is
  27. still running.  The reason I want the segment to be remove when shm_nattck
  28. equals zero is that the client can use this (shmget() failure) to determine
  29. the existence of the server.  As we all know that some signals can not be
  30. caught, and the pid could be reused by another process (it may take a
  31. long time, but ...).  I know that there are many other ways to do this
  32. e.g. using shmctl(IPC_STAT) to get shm_nattck, or using file with flock().
  33. We have decided to used file instead of shared memory.  I did learn some
  34. thing about shared memory.
  35.  
  36. Jason
  37.  
  38.  
  39.  
  40. -- 
  41. Jason X.G. Chen      | "A distributed system is one in which the 
  42. Ph:  (613) 765-4844  | failure of a computer you didn't even know 
  43. Fax: (613) 763-2202  | existed can render your own computer unusable"
  44. Email: jasonc@bnr.ca |                   Leslie Lamport
  45.