Locking data structures in distributed systems
I am completely new to the concepts of distributed systems. Please let me know even if the question needs to be rephrased.
I am trying to create distributed systems with 10 clients and one server. On the server side, there is a queue that clients can access one at a time. So, what locking mechanism can you use to avoid false data? Are semaphores possible in this situation? If possible, kindly provide a link to have a much deeper knowledge of this.
source to share
Server-side semaphores are possible and in fact that is the way to go. On a GNU / Linux system such as Debian, see man 7 sem_overview
and man 1 lockfile
.
The simplest method probably allows the server to serve no more than one client at a time, discarding all requests from other clients. A rejected client waits for a random (undefined) period of time and then tries again.
Another technique might be to allow server queue requests, but this is more difficult (and may still involve discarding some requests).
source to share