S
S
Sergey Sokolov2017-03-17 10:43:03
Algorithms
Sergey Sokolov, 2017-03-17 10:43:03

Is it possible to implement a mutex on a store where there are only set and get?

Redis has a wonderful Redlock algorithm that allows you to reliably implement mutex (mutual exclusion) on distributed storages. But it is based on the insert-if-key-no ( SET ... NX) operation.
The question arose: is it possible to implement mutex based on storage VKontakte, where there are only operations set( key, value)and get(key)? There is a utils.getServerTime() method to get server time accurate to seconds.
The task is to coordinate several independent agents among themselves, so that at any time one of them will take on the task. The only connection they have with each other is through this VK storage.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2017-03-17
@begemot_sun

No. The check-key-insert-new operation is not atomic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question