Aaron W. LaFramboise wrote:
In a multi-segment implementation, would an object like a vector be able to span multiple segments? I think not, but I'm not sure.
No, because the memory must be contiguous. But other structures like deque/map-set/list could be implemented.
If general growing of managed segments is too hard, maybe an easier problem could be solved, like making shared memory containers that have special support for growing.
I think you reach the same problem. You need to allocate more pages from the OS and map them atomically in every process sharing those pages.
I agree with you about O_CREAT. But what about on Windows, with CreateFileMapping? "If the object exists before the function call, the function returns a handle to the existing object (with its current size, not the specified size), and GetLastError returns ERROR_ALREADY_EXISTS."
It seems the API has a little bit of a POSIX bias. :)
It's not that I like POSIX, it's just it was easier to emulate POSIX for Windows than doing the inverse. Shmem had a Windows approach but shared memory lifetime was a real issue, so I changed to a POSIX-like approach. I've tried to be portable, but maybe I should add extensions for systems where the programmer can get more information. Thanks for your comments, Ion