Multiple links to shared memory segments

From: James Galbraith (galbja_at_inel.gov)
Date: 02/05/04


Date: 5 Feb 2004 11:43:23 -0800

Hi,
I've been migrating some software developed under Linux, Solaris, and
SGI to one of our HP platforms and have run into a roadblock. I've
got a few objects that each need to attach to the same shared memory
segment. I'm using the POSIX shm_open() and mmap() functions. The
first attach completes OK, with all following attaches failing with
the dreaded ENOMEM error. This is documented in the man pages,
indicating that HPUX is unable to support multiple links to a single
shared memory segment to to the memory architecture. It continues to
indicate that if the mmap call is modified to use the MAP_VARIABLE
option and let the OS determine the location it is mapped, all will be
OK. Well, it isn't. I've tried the method(s) indicated in the man
page and continue to have problems.

Has anyone out there had any success utilizing multiple links to a
shared memory segment using the POSIX functions?? If so, I would
greatly appreciate hearing about your solution so I can get my porting
on track.

I'd like to stay away from creating global pointers for the obvious
reasons. Besides my objects are all template based and creating
shared-memory-specific pointers would be a problem.

Thanks

James Galbraith
Idaho National Engineering and Environmental Laboratory
galbja@inel.gov



Relevant Pages

  • Re: Multiple links to shared memory segments
    ... |got a few objects that each need to attach to the same shared memory ... I'm using the POSIX shm_openand mmap() functions. ... |shared memory segment to to the memory architecture. ...
    (comp.sys.hp.hpux)
  • Problems accessing shared memory
    ... create or access the shared memory segment on a specific computer. ... The problem also appeared on a system using Windows 2003 server and Windows ... but we found a fix. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Is shmdt() necessary?
    ... When using shared memory, one process usually attaches to the shared ... memory by calling shmat, and will detach from it before it exits, by ... attach number if one process ends without calling shmdt. ... Some people find it more elegant to explicitly detach everything they ...
    (comp.os.linux.development.system)
  • Re: A shared library which attaches a shared segment - whats the right way??
    ... > The varibale which attaches the shared memory segment using 'shmat' is ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.aix)
  • Re: Argument shmaddr in shmat()
    ... void *shmat(int shmid, void *shmaddr, int shmflg); ... If the shared memory segment has never been attached to by any ... Does it mean that if the only process works with the shared memory ... segment, then shmaddr must be set 0 in shmat(), i.e. ...
    (comp.sys.hp.hpux)

Quantcast