I am working on a client server system, and am running into issues where multiple clients are executing an action at the same time. We are able to solve this by locking on the critical section of code, which ensures that the first client will complete the action before the second client enters the code block. My question is this: our server is also clustered, so multiple instances of the server itself can exist, which recreates the same problem as before. How could we solve this problem? Thanks!
To expand on the problem: The first user is checking if an action is valid and getting a yes response. The second user is checking if an action is valid and also getting a yes response before the first user completes his/her action. But the first user's action should make the second user's action invalid. The problem is that the check occurs nearly simultaneously for each user.