home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp
- Path: sparky!uunet!utcsri!torn!cunews!nrcnet0!bnrgate!bmers145!bnr.ca!jasonc
- From: jasonc@bnr.ca (Jason Chen)
- Subject: Re: Shared memory in 6.5
- Message-ID: <1992Jul21.150922.17048@bmers145.bnr.ca>
- Sender: news@bmers145.bnr.ca
- Reply-To: jasonc@bnr.ca (Jason Chen)
- Organization: Bell-Northern Research Ltd.
- References: <1992Jul16.140923.16870@bmers145.bnr.ca> <7371155@hpfcso.FC.HP.COM>
- Date: Tue, 21 Jul 92 15:09:22 GMT
- Lines: 32
-
- In article <7371155@hpfcso.FC.HP.COM>, rdg@hpfcso.FC.HP.COM (Rob Gardner) writes:
- |> I still don't understand your situation clearly. Even if multiple
- |> processes need to attach the segment, depending on your application,
- |> you can have the last process that needs to attach it call
- |> shmctl(IPC_RMID). Sorry, but that's the best you can do; Shared
- |> memory segments are *meant* to stick around after processes die,
- |> and you must remove them explicitly.
-
- Rob,
-
- Thanks again for the reply. Here is what I tried to do:
- 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
-
-
-
- --
- Jason X.G. Chen | "A distributed system is one in which the
- Ph: (613) 765-4844 | failure of a computer you didn't even know
- Fax: (613) 763-2202 | existed can render your own computer unusable"
- Email: jasonc@bnr.ca | Leslie Lamport
-