Monday 15 April 2013

unix - how same key is used across processes to communicate each other using shared memory -


I have learned that to use shared memory, it is necessary to use the same key in both processes, in the sample code I saw , The key is difficult in both programs (sender, receiver). My suspicion is that in real time that two unexpected processes use the same key I have read about the photoc () function, but this file asks for the path as a logic. But how can this be possible in the situation below in real time

Assume that when a user prints the file command from Firefox, then thinking about creating another program such as ghostscript ps / pdf file (It shares shared memory). Here's how Firefox and Ghostscript will use shared memory

To define each other's unknown processes Need sharing shared memory simultaneously (and share) protocols And that protocol will need to include information about shared memory (for example, an integer value for a shmget call). Actually, it will need to define some "hard coded" identifier or some method to find it.

Without some types of protocols defining this information (what is in memory), it would not be possible to remove a process that is also installed in any memory location that was installed by another process Was there.

No comments:

Post a Comment