I am using CSharpTest.Net.BPlusTree library for data storage. How can I read from the same tree from different processes?
Asked
Active
Viewed 18 times
0
-
[WCF](http://msdn.microsoft.com/en-us/library/ms731082%28v=vs.110%29.aspx)? – spender Sep 07 '14 at 19:56
-
No. I am trying to read from the same tree from multiple instances of an windows application. – Victor Mukherjee Sep 07 '14 at 20:03
-
1Yes, but given that the process boundary is not one across which you can read memory, your idea is dead in the water. Your only option is to create a service on to your tree. – spender Sep 07 '14 at 20:04
-
I am not good with multi thread or multi process, but can there not be a mutex locking ? – Victor Mukherjee Sep 07 '14 at 20:08
-
it might have been a good idea to mention that this tree is ***disk based***. I'm going to close this as a dupe because it's been covered elsewhere. Wouldn't taking exclusive access to the file while you're operating on it do the trick? – spender Sep 07 '14 at 20:11
-
You'll also need to switch the `CachePolicy` to `None` so that changes from another process don't leave you with a corrupt local process cache. I think once you're contending for the file to this degree, you might be better off serving access to it from a single process. – spender Sep 07 '14 at 20:16
-
It would be good to read the [author's note](http://csharptest.net/projects/bplustree/): "Multiple instances of a BPlusTree using the same file is not supported unless the ReadOnly property on the Options class is set to true. Though it is possible to build this into or on top of the BPlusTree I personally prefer to use a single instance and IPC/RPC to allow cross-domain or cross-process access." – spender Sep 07 '14 at 20:21