On 25 November 2011 19:58, Pablo Herrero <pablodherrero@gmail.com> wrote:
2011/11/25 Igor Stasenko <siguctua@gmail.com>:
On 25 November 2011 16:25, Pablo Herrero <pablodherrero@gmail.com> wrote: Usually for this you just use critical sections.
sema := Semaphore forMutualExclusion.
process1:
sema critical: [ Â here you modify your data ]
process2:
sema critical: [ Â here you commit your data ]
so, why this is not appropriate for your model?
The thing here is that some processes may not be aware there's a transaction running in the background, and could be reading or modifying objects which are involved in some transaction. So it wouldn't be possible for them to anticipate which objects should be accessed inside a lock.
In this case, all such objects should be wrapped by proxies, then at attempt to access them you entering critical section. Of course this may make things running slower :) To make sure that nothing can interrupt given process, you should run it at highest possible proirity. But then you will rely on scheduling semantics currently employed in system. In case if we change scheduler to allow running processes in parallel or to allow all active processes to progress a bit in given quanta of time, this approach won't work. -- Best regards, Igor Stasenko.