Automatically replace memory mapping in Windows

Is there a way to atomically replace memory mapping in Windows?

On Unix, mmap () with MAP_FIXED will atomically replace the page displayed at the requested address.

But on Windows, MapViewOfFileEx () cannot be used by address if the page is already mapped. An existing page must first be disabled, for example. with UnmapViewOfFile (). This means that there is a short period during which the address is unallocated, so if another thread creates a memory map at the same time, it can be placed at that address.

Is there an interface on Windows that circumvented this problem without changing the kernel? Is it possible to use system calls directly?

+3
source share

Source: https://habr.com/ru/post/1723457/


All Articles