| Author |
Remote synchronization
|
|
| Kelvin Moss 2005-12-29, 7:51 am |
| Hi all,
I have a distributed application (in C++) that runs on several
(identical) machines. I have a shared resource (say a directory
server). I check the value and set values in the directory server. I
want to make these operations atomic i.e. process on machine1 checks
and sets value without interference from any process on any other
machine.
I realize that I need a remote synchronization primitive. How could
this be achieved ? Any pointers would be appreciated.
Thanks.
| |
| John Smith 2005-12-29, 6:05 pm |
| > I realize that I need a remote synchronization primitive. How could
> this be achieved ? Any pointers would be appreciated.
>
How about a server-side mutex? Whenever a client is suppose to do one of
these operations (read or set) the server has a mutex which is the same for
all the clients. Maybe only writing needs to be atomic but it depends on
your application.
In terms of programming there are more ways you can do it but assuming you
have pthreads you could look into pthread mutex's.
-- John
| |
| Maxim Yegorushkin 2005-12-29, 6:05 pm |
|
John Smith wrote:
>
> How about a server-side mutex? Whenever a client is suppose to do one of
> these operations (read or set) the server has a mutex which is the same for
> all the clients. Maybe only writing needs to be atomic but it depends on
> your application.
Another option is to handle all requests in one event-driven thread.
This way you don't have to use mutexes, since only one thread ever
accesses shared data.
|
|
|
|