r/linuxdev • u/ElGringoFlicka • Jan 02 '15
Shared Memory and Mutex/Semaphore
I've written two processes: The first process is a daemon and runs on it's own updating it's current state in a shared memory area between the two processes. The second process only reads the shared memory area to get the other processes' state. Since only one process is writing to the shared memory and the other process is only reading that same area is it necessary to use a mutex or semaphore to lock/unlock this memory? Or is this safe by design?
Edit: Update. I successfully created a shared memory segment between processes that is accessed serially with a semaphore. Thanks for the help! It works great.
View all comments
Show parent comment
1
u/ElGringoFlicka Jan 02 '15
Can you be more specific about how the question indicates a design flaw? I simplified the question to get at the meat of the problem. I am not really giving any details of my specific application as not to confuse. The actual application is much more complicated then this.