lonhyn@eniac.seas.upenn.edu (Lonhyn Jasinsky) (12/03/88)
Has anyone out there ever needed/implemented some nifty scheme for managing shared memory? I have a program that currently malloc's all of its structures and whatnot. I would like to change it so that it instead keeps all of the data in shared memory. I therefore need something to carve up and manage chunks of shared memory in a sane manner. Of course I need to attach it at the same addresses in each process so that pointers in linked lists and that kind of stuff continues working, however I have a number of problems: 1) I don't want to rewrite malloc, although this might be what I end up doing. 2) Malloc as it is will not cooperate because of obvious dependencies on brk and sbrk. 3) Shared memory itself appears difficult to grow although a bunch of chunks could be attached contiguously in each processes address space. Has anyone seen some public domain piece of code to do this or have some code they would not mind sharing? Being able to free memory that has been "shmalloc()'ed" is not overly important as this is to store an environment that is not going to do much shrinking. Any help someone could give me would be appreciated. Either e-mail me (I'll summarize) or post direct. Thanks, Lonnie -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Email to: lonhyn@eniac.seas.upenn.edu Smail To: /dev/null Disclaimer: All views and opinions expressed here belong entirely to the organization mentioned above. They have sole rights to my every waking thought. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
crossgl@ingr.UUCP (Gordon Cross) (12/05/88)
In article <6490@netnews.upenn.edu>, lonhyn@eniac.seas.upenn.edu (Lonhyn Jasinsky) writes: > > Has anyone out there ever needed/implemented some nifty > scheme for managing shared memory? I have a program > that currently malloc's all of its structures and whatnot. > I would like to change it so that it instead keeps all of > the data in shared memory. I therefore need something to Yes I have a general memory manager that allows you to define address ranges to be carved up. It also has facilities for growing sizes (defined by a user routine) and trapping out-of-memory conditions. And I also have a version of "malloc" which is built on this algorithm. It is designed to be VERY fast especially on paging systems by managing internal data structures in such a way as to avoid "memory wandering" to find available chunks. There is even a "stackalloc" to allocate TEMPORARY memory from your stack [this one could in general be difficult to port if the compiler tries to get too smart about the stack -- assuming you have a stack :-)]. If you want to have a go at it, just let me know (I have not been in the habit of trying to write "portable" code but it should port without too much difficulty). Gordon Cross Intergraph Corp. Huntsville, AL ...uunet!ingr!crossgl
crossgl@ingr.UUCP (Gordon Cross) (12/05/88)
In article <6490@netnews.upenn.edu>, lonhyn@eniac.seas.upenn.edu (Lo> > Has anyone out there ever needed/implemented some nifty > scheme for managing shared memory? I have a program > that currently malloc's all of its structures and whatnot. > I would like to change it so that it instead keeps all of > the data in shared memory. I therefore need something to Yes I have a general memory manager that allows you to defineax ress ranges to be carved up. It also has facilities for growing sizes (defined by a user routine) and trapping out-of-memory conditions. And I also have a version of "malloc" which is built on this algorithm. It is designed to be VERY fast especially on paging systems by managing internal data structures in such a way as to avoid "memory wandering" to find available chunks. There is even a "stackalloc" to allocate TEMPORARY memory from your stack [this one could in general be difficult to port if the compiler tries to get too smart about the stack -- assuming you have a stack :-)]. If you want to have a go at it, just let me know (I have not been in the habit of trying to write "portable" code but it should port without too much difficulty). Gordon Cross Intergraph Corp. Huntsville, AL ...uunet!ingr!crossgl #! rnews 1602Fr