Skip to content
Advertisement

Tag: shared-memory

Linux IPC: shared memory recovery

I have two processes (a producer and a consumer) communicating via a shared memory segment produced using the ‘old’ interface rather than mmap: The producer process could be restarted due to an error or configuration change. It creates a new region each time using the IPC_CREAT flag to shmget(). I have noticed that the consumer can continue to read from

Share Memory in Linux using C

Is it safe to use shm_unlink even there are other process currently open the shared memory? For exmaple: Process B shm_open and then Process A shm_unlink. Is it ok for Process B? Answer Yes, it is safe to call shm_unlink if another process has it opened. Per the man page for shm_unlink: The operation of shm_unlink() is analogous to unlink(2):

POSIX shared memory model

Is there a memory model specification for POSIX shared memory (across processes)? I’m hoping that there’s something to comparable to the C++ memory model, in order to answer questions like the following: Is there a definition of a data race? Are data races undefined behavior (as in C++)? Is there something to constrain memory visibility order across processes? I know

What type of memory objects does `shm_open` use?

Usually, shared memory is implemented using portions of On-Disk files mapped to processes address spaces. Whenever a memory access occurs on the shared region, the filesystem is involved to write changes on the disk which is a great overhead. Typically, a call to fopen() returns a file descriptor which is passed to mmap() to create the file’s memory map. shm_open,

shmat() Permission denied even i have read access

In my simple code: I already have read access, but I got “shmat: Permission denied”. Do I have permission to write? Answer From man shmat: If SHM_RDONLY is specified in shmflg, the segment is attached for reading and the process must have read permission for the segment. Otherwise the segment is attached for read and write and the process must

Advertisement