Details
-
Sub-Task
-
Status: In Progress (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
-
2026-8, 2026-9, 2026-10
Description
Change the way of working with shared memory as follows:
- split the shared segment into a fixed-size metadata area and a data area
- in the metadata area, store the key of the current data area
- when making changes to the data area, instead of changing in place, the writer should:
- allocate a new data area
- copy the information from the current data area
- make all necessary changes in the new area
- atomically write the key of the new data area to the metadata
Pros:
- at any given time, there is a consistent state by design
- there is no need for complex synchronization of readers and writers, a pointer to the data area can be stored in the normal address space of the process
- from the point above, it follows that no reader should wait for the completion of data changes
- a writer crash at any time will not cause data corruption, the key always points to completely correct data
Cons:
- it is necessary to think over the mechanism of deleting outdated segments
- similarly for new segments that were not "committed" as current due to a writer crash
- it is possible to worsen the performance of writing due to the need to copy data (it seems that this is not significant, but it should be measured)