Process-1 writes data into Shared memory; It crashes; Can process-2 later read that data?

Process-1 writes data into Shared memory; It crashes; Can process-2 later read that data?

Post by qazmlp120 » Fri, 29 Jul 2005 16:24:18


One basic question on 'Shared Memory':
One process has written some data onto the shared memory. After that,
the process crashes due to some fault. Can someother process later read
that data? In my understanding, it should still be available until the
process who owns that segment explicitly detaches it. Am I right? Can
somebody clarify this?
 
 
 

Process-1 writes data into Shared memory; It crashes; Can process-2 later read that data?

Post by Gianni Mar » Fri, 29 Jul 2005 16:35:06


That would be my understanding.

Shared memory may be a mapped file, in which case the file will persist
the data written to it until the file is removed.

 
 
 

Process-1 writes data into Shared memory; It crashes; Can process-2 later read that data?

Post by maxim.yego » Fri, 29 Jul 2005 17:30:45


Shared memory, as well as message queues and semaphores, has kernel
persistence. This means, unless its public name is unlink()ed, it lasts
till the kernel lives. Note that one can create shared memory without a
public name.

In one VoIP router we used shared memory for storing Call Details
Records (CDRs). If for some weird reason the server crashed a new
server would reopen the shared memory, finilize CDRs and dump them to a
database.