shmat() & shmdt() questions.

Moellers josef at nixpbe.UUCP
Mon Sep 17 16:51:11 AEST 1990


In <24482 at adm.BRL.MIL> TAYBENGH%NUSDISCS.BITNET at cunyvm.cuny.edu writes:


>        I have 3 questions regarding usage of shared memory:
>        1) can a child process inherit shmid from parent? i.e. does the shmid
>valid in the following program segment?

[example deleted]
- the manual sais that children inherit any ATTACHED shared memory
  segments (SMSs)
- the shmid is just an id which is bound to the SMS, so it should make
  no difference whether the parent hands the shmid to it's child or the
  child gets the shmid itself.

>        2) can a child inherit the virtual address return by shmat()?
[code example deleted]
see my first remark on question 1.

>        3) if a process quit without shmdt() the shared memory it attached
>to, will the OS detect and decrement the shm_nattch in structure sgmid_ds?

Yes (if the OS is programmed properly B-{)

>        Thanks a lot for the help.

Hope it was any.
--
| Josef Moellers		|	c/o Nixdorf Computer AG	|
|  USA: mollers.pad at nixdorf.com	|	Abt. PXD-S14		|
| !USA: mollers.pad at nixdorf.de	|	Heinz-Nixdorf-Ring	|
| Phone: (+49) 5251 104662	|	D-4790 Paderborn	|



More information about the Comp.unix.internals mailing list