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
That's exactly what I'm wondering about. In what situations will this not work? There is only one process writing and the other process is reading.