What are some good ways to do intermachine locking?

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-03-15T17:08:54Z Indexed on 2010/03/15 17:29 UTC
Read the original article Hit count: 254

Filed under:
|
|
|

Our server cluster consists of 20 machines, each with 10 pids of 5 threads. We'd like some way to prevent any two threads, in any pid, on any machine, from modifying the same object at the same time.

Our code's written in Python and runs on Linux, if that helps narrow things down.

Also, it's a pretty rare case that two such threads want to do this, so we'd prefer something that optimizes the "only one thread needs this object" case to be really fast, even if it means that the "one thread has locked this object and another one needs it" case isn't great.

What are some of the best practices?

© Stack Overflow or respective owner

Related posts about mutex

Related posts about multithreading