View Full Version : Does the ReplayEngine have any shared memory limitations?

08-15-2011, 02:17 PM
ReplayEngine does not support programs that use shared memory. This includes programs that mmap shared memory with other processes, and programs that mmap volatile files; for example, files that are changed by other processes or the system while your process is executing.

This means that mmap() using the MAP_SHARED flag is not supported. Similarly, ipc system calls that involve shared memory are not supported; for example; the following libc calls are not supported: shmat(), shmctl(), shmdt(), and shmget().

When ReplayEngine notices that a mmap is being called with the MAP_SHARED variable set it will force the mmap call to fail with -1 and errno set to ENOMEM. This is done so that you are allowed to continue to using the ReplayEngine should your application call mmap. Some programs do not directly enable or depend upon shared memory and thus this will be sufficient. This however can be controlled by a totalview state variable, TV::replay_map_shared which defaults to 3. Valid values are:

1. On mmap with MAP_SHARED, stop the target and disallow forward progress.

2. On mmap with MAP_SHARED, remove MAP_SHARED and proceed with the map.

3. On mmap with MAP_SHARED, return error code ENOMEM and continue.

For example, if you prefer that instead of the mmap failing for ReplayEngine to change the call to be not shared you can set the state variable to 2. In your $HOME/.tvdrc you would add:

dset TV::replay_map_shared 2

Josh Carlson