I’m thinking to use MemoryMappedFile to share memory between multiple processes.
While one process is reading and writing (and something more), I don’t want another process to access the memory.
If it is possible, how could I implement it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is a common practice to use synchronization objects like Mutex or Semaphore when dealing with inteprocess synchronization. Named mutex could be shared between processes and give what you want, especially if you have managed and unmanaged code runnning on separate processes.
But be aware that mutex that was created by process with more elevated rights will not be accesible for processes with less rights. Such thing could happen when you create mutex on windows service with some kind of admin rights and then will try to access mutex from IIS web application which was launched as Network Service.