We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See: https://groups.google.com/d/msg/comp.os.linux.development.system/Prx7ExCzsv4/saKCMIeJHhgJ
The algorithm should be:
void* alloc_mirrored(size_t size) { assert(size % allocation_granularity() == 0); // Create a file and unlink it: int fd = shm_open("/unique_name", O_RDWR | O_CREAT | O_EXCL, 0600); // handle_errors(fd); shm_unlink("/unique_name"); // on Linux one might be able to avoid the link/unlink dance // Resize the file ftruncate(fd, size); auto addr1 = mmap(0, 2*size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); // handle_errors(addr1); auto addr2 = mmap(addr1+size, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); // handle_errors(addr2); close(fd); // will stay alive until we unmap return addr1; } void dealloc_mirrored(void* ptr, size_t size) { munmap(ptr, 2 * size); }
The text was updated successfully, but these errors were encountered:
Initial implementation in https://github.com/gnzlbg/slice_deque/tree/posix_race_free
Sorry, something went wrong.
A race-free algorithm for Linux has been added, but a POSIX-compliant implementation using only /dev/shm remains to be implemented.
/dev/shm
No branches or pull requests
See: https://groups.google.com/d/msg/comp.os.linux.development.system/Prx7ExCzsv4/saKCMIeJHhgJ
The algorithm should be:
The text was updated successfully, but these errors were encountered: