
On Mon, Jan 18, 2010 at 1:27 PM, Oliver Kowalke <k-oli@gmx.de> wrote:
I would suggest a three phase model for transactions operating on shared resource:
1.) prepare phase: multiple readers/one writer have access to the resource 2.) modification phase: only one writer has access and can can modify the resource 3.) commit/rollback phase: write publishes its local modifications and releases the execlusive lock
I'm not sure what the granularity of 'shared resource' is, in your statement. Currently, for a shared resource of "map", I do permit simultaneous, modifications of the map concurrently. However, what you describe is the model I'm using for modifications to individual entries within the map with the exception that I'm using multi-version concurrency control so that when one thread acquires exclusive write access (2) to an entry, read-only access by other threads continues without contention. The moment of commit (3) does include some exclusive access to the map during the write of all local modifications back into the shared resource.