In shared memory system, when two processes share a shared memory segment, after one process is killed, how will the other running process be notified of the killed process by the shared memory system ?
The only way you could handle this would be to have some kind of heartbeat system between the processes. For instance the first process could share its PID in shared memory.
Subsequent processes could announce themselves by sending a signal such as SIGUSR1. Then they could keep sending SIGUSR2 at intervals as a heartbeat. Two missing SIGUSR2 signals in a row would tell you that the process had died. You would need to use sigqueue(2) sigaction(2) to communicate the PID of the signal sender for this to work.
Another way is to arrange for the other sharing processes to be children of the first process to access the shared memory. Then the death of a child results in an automatic SIGCHLD to the parent. Even if you currently have the sharing processes started independently, you could change those to signal the first process that a new process wants to share memory. Then the first process could fork a new child to take over the activity of the process that wants to share memory, thus preserving the parent/child relationship.
Personally, I would first look at a more modern IPC method such as 0MQ (go here and read the guide) before I would try to implement this with UNIX kernel services. I would even give up on shared memory, and use memcache to share the data. In fact I have implemented a system with several processes using 0MQ for heartbeats and IPC and sharing memory via memcache.
It isn't. Processes can attach and detach to the shared memory segment at any time and no notification is given to other attached processes ( if there even are any ).