the only tricky bit is, and this is relevant i should imagine to doing shared, complex data structures in samba, an also a possible solution to some of the issues in APR, how do you guarantee that multiple processes - no, _all_ processes - get access to the same fixed address memory segment / segments?
i wasn't aware that mmap could do fixed memory segments, otherwise i would have suggested (on apr dev) an sms_shmem that used shared memory. [fyi: sms - Smart Memory system. it's a wrapper around memory management that presents the same API to mlock()ed, mmap()ed, kernel-page-mapped, etc. memory, that has support for either malloc/realloc/free style or pool-style such as Trivial Alloc and APR pools management]. a few months back or so, doing an sms_shmem was considered [with a view to then presenting that via an apr_pool_t interface] however, the trouble with shared memory is [was!] that the offsets in the different processes for the shared memory segment are different. so, placing a linked list or any data structures with pointers in it is a waste of time. now, i know that in samba there are shmem-start-relative linked lists to data structures *without* pointers in them., so i know this can be done. and doing a linked list in MAP_FIXED segments would be an awful lot easier, in fact it would be trivial. the only thing, then, that is of concern, is how to link several segments together: it's not a good idea to mmap a massive segment of memory, have to do several smaller ones. what happens if you run out and have to get some more MMAP_FIXED segments? how do you guarantee that all processes will all successfully mmap the same shared memory segment at the same address? how do you communicate the _need_ to get more MMAPED_FIXED segments to all processes? :) [please, someone tell me if i am explaining this clearly enough] or, should the first implementation avoid this by specifying the required segment size at apr_initialise() time or as a parameter to apr_sms_shmem_create()? luke On Thu, Sep 06, 2001 at 12:37:27PM -0700, Jeremy Allison wrote: > Luke Kenneth Casson Leighton wrote: > > > is it possible to get memory allocated in one process to be shared > > with another process *at the same address* on unix, os/2, nt, vms etc? > > mmap has the MAP_FIXED flag that forces the mmap to fail > if it can't be done at the given address. You could use > a different IPC method to pass that address to other > processes. > > This is UNIX/POSIX only though (as far as I know). > > Jeremy. > _______________________________________________ > dcom-dev mailing list > [EMAIL PROTECTED] > http://lists.dcerpc.net/mailman/listinfo/dcom-dev
