MAP_FIXEDis dup2for memory mappings and is useful in the same situations when it dup2is useful for file descriptors: when you want to perform a replacement operation that atomically reassigns a resource identifier (memory range in case MAP_FIXED, or fd in case dup2) to refer to a new resource without race capability, where it can be reassigned to something else if you first released an old resource and then tried to return it to a new resource.
( ). , , : read + exec-only , ( , ) ( .bss). , . , ( ) MAP_FIXED, , MAP_FIXED , .
, , MAP_FIXED . MAP_FIXED - , mmap MAP_FIXED, - , . dup2; dup2, fd .