Jul 22, 2024

[mremap] Accessing the same physical memory page, but via different virtual memory address

If you have a release/acquire pair on the same physical address and different virtual addresses, tsan won't understand it and start spewing false positives.

Shared memory involves multiple virtual addresses for the same underlying memory (typically in different processes but it's often useful to test with threads in the same process). 

On linux mremap can create multiple mappings (virtual addresses) for the same memory within an address space which is useful for some situations such as creating mappings with different protections - other OSes have similar APIs.

Unless you're working on butter/aperture, shared memory is usually wild overkill in terms of complexity/performance tradeoff. Just use unix domain sockets to communicate between processes.


Reference:
https://youtu.be/XRAP3lBivYM?si=PElT9kzXXbWmiLna


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.