This PR introduces the ResizableSharedMemory concept. It will become the basic building block for dynamic publishers and server/clients.
The basic idea is, that the ResizableSharedMemory will create a new segment for all chunks with a specific layout whenever during allocate() the current segment returns out-of-memory, alignment unsupported or size unsupported.
The segment id is stored in the PointerOffset. The PointerOffset is not allowed to be larger than 64-bit because of the underlying lock-free algorithms.
Therefore, the maximum supported shm size of iceoryx2 shrank to 65535 TB to make space for the 8 byte segment id.
Old segments are removed by the ResizableSharedMemory on deallocate when no more chunks are in use and the mapping is removed in the ResizableSharedMemoryView when no more chunks are registered there.
The ResizableSharedMemory will be used by the Publisher as data segment and deallocate is called whenever the Subscriber returns a sample. The ResizableSharedMemoryView is used by the Subscriber to read the incoming samples. Before reading the Subscriber has to register the sample there to map new segments and has to deregister it before returning it to the publisher to unmap old segments.
Please focus on 2 things in this review:
Is the API for the ResizableSharedMemory a good fit also for future use cases?
Are there some tests missing for the ResizableSharedMemory. A good way to review this, is to look at just the test names and see if there is some use case I have missed.
Pre-Review Checklist for the PR Author
[x] Add sensible notes for the reviewer
[x] PR title is short, expressive and meaningful
[x] Relevant issues are linked in the References section
[x] Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
[x] Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
[x] Commits messages are according to this guideline
[x] Commit messages have the issue ID ([#123] Add posix ipc example)
Notes for Reviewer
This PR introduces the
ResizableSharedMemory
concept. It will become the basic building block for dynamic publishers and server/clients.The basic idea is, that the
ResizableSharedMemory
will create a new segment for all chunks with a specific layout whenever duringallocate()
the current segment returns out-of-memory, alignment unsupported or size unsupported. The segment id is stored in thePointerOffset
. ThePointerOffset
is not allowed to be larger than 64-bit because of the underlying lock-free algorithms. Therefore, the maximum supported shm size of iceoryx2 shrank to 65535 TB to make space for the 8 byte segment id.Old segments are removed by the
ResizableSharedMemory
ondeallocate
when no more chunks are in use and the mapping is removed in theResizableSharedMemoryView
when no more chunks are registered there.The
ResizableSharedMemory
will be used by thePublisher
as data segment anddeallocate
is called whenever theSubscriber
returns a sample. TheResizableSharedMemoryView
is used by theSubscriber
to read the incoming samples. Before reading theSubscriber
has to register the sample there to map new segments and has to deregister it before returning it to the publisher to unmap old segments.Please focus on 2 things in this review:
ResizableSharedMemory
a good fit also for future use cases?ResizableSharedMemory
. A good way to review this, is to look at just the test names and see if there is some use case I have missed.Pre-Review Checklist for the PR Author
SPDX-License-Identifier: Apache-2.0 OR MIT
iox2-123-introduce-posix-ipc-example
)[#123] Add posix ipc example
)task-list-completed
)Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #497