On Sat, 5 May 2001, Ralf S. Engelschall wrote:
> In article <[EMAIL PROTECTED]> you wrote:
>
> > MM does not have a malloc-like API. It comes close, but the first thing
> > MM makes you do to get shared memory, is to decide how much shared memory
> > you want total. That would be fine, but then if I request 1024k of shared
> > memory, and only allocate it in smaller blocks, then MM will use portions
> > of my 1024k for itself. That means that I can't allocate all 1024k for
> > myself.
>
> And what do you suggest for improvement, Ryan?
>
> The only really reasonable possibility from my point of view (and
> which is in my TODO list for a longer time) is that MM's "Standard
> Malloc-Style API" bases its memory pool not on just a single shared
> memory segment, but on multiple segments and then automatically adds a
> segment if the pool is exhausted. A patch for this is welcome.
this doesn't even sound possible at all. you can't force a shared memory
mapping to appear at the same address in another process, and you can't
even force another process to attach a new shared mem segment.
this would mean you couldn't use pointers in the shared memory. ok maybe
this is already a restriction and you guys use offsets from the shm base.
but with a dynamically expandable change like this then you're going to
require every offset/pointer dereference is going to require a test first
to see if that part of the shared memory is already mapped.
not to mention that unless you've got sysv shm, then you need to create
files on disk somewhere to be backing store for the memory, because
there's no other way to pass a segment to another, already existing
process.
and if you go to all this trouble then can i heartily recommend a visit to
<http://www.sleepycat.com/> :)
then you'd get all sorts of useful primitives.
i really think that MM's rather simple API is the right API. and that
what's being suggested is overkill, and will hurt performance.
it sounds to me like what the "must look like malloc" folks want is more
commonly referred to as multithreaded programming.
but maybe i'm missing something :)
-dean