From: Eric Hodel Date: 2007-05-31T12:45:02+09:00 Subject: Re: DRb and Thread safety On May 30, 2007, at 19:29, Erwin Abbott wrote: > I've been reading about DRb and one issue that I still have questions > about is thread safety. Every website I've come across uses very > basic examples where the client never does anything that would modify > the distributed object. > > For sake of discussion, let's say I'm writing an application that's > some kind of database. Clients can add, delete, search, or modify > records. How can this be written so clients can't step on each other, > or block the whole database while perfoming and update on a single > record? Having a mutex for every record doesn't seem very elegant. Having your database be a Rinda::TupleSpace is one way around it. > I'm also still getting aquainted with threads, and I want to be sure I > have this right: each thread has it's own "local" variables, so if two > threads have access to the same array and they both call array.max... > any local vars used in the #max method won't be "stepped on" by the > other thread. As long as #max doesn't change any variables outside its > method scope, it will be thread safe? Correct.