We present a randomized approach for lock-free locks with strong bounds on time and fairness in a context in which any process can be arbitrarily delayed. Our approach supports a tryLock operation that is given a set of locks, and code to run when all the locks are acquired. Given an upper bound $\kappa$ known to the algorithm on the point contention for a tryLock it will succeed in acquiring its locks and running the code with probability at least $1/\kappa$. It is thus fair. If the algorithm does not know the bound $\kappa$, we present a variant that can guarantee a probability of at least $1/\kappa\log\kappa$ of success. Furthermore, if the maximum step complexity for the code in any lock is $T$, and the point contentions are constant, the attempt will take $O(T)$ steps. The attempts are independent, thus if the tryLock is repeatedly retried on failure, it will succeed in $O(T)$ expected steps, and with high probability in not much more. Importantly, however, retrying is not mandatory, and a process may choose to execute different code upon failure. We assume an oblivious adversarial scheduler, which does not make decisions based on the operations, but can predetermine any schedule for the processes, which is unknown to our algorithm. Furthermore, to account for applications that change their future requests based on the results of previous lock attempts, we strengthen the adversary by allowing decisions of the start times and lock sets of tryLock attempts to be made adaptively, given the history of the execution so far.
翻译:我们提出一个随机的方法,用于在任何程序都可能被任意拖延的情况下,有严格时间和公平约束的无锁锁。 我们的方法支持所有锁都获得时运行的试 Lock 操作的概率为1美元/ kapa/log\kappa/ 代码。 如果在点角对试 Lock 争论的算法上有一个上限 $\ kapa$, 它将成功获得它的锁并运行代码, 概率至少为1美元/\\ kapa$。 因此这是公平的。 如果算法不知道约束$\ kapa$, 我们的方法会提出一个变量, 可以保证至少1美元/ kapa\ log\ kappa$的成功概率。 此外, 如果任何锁中代码的最大步数复杂度为$T$, 而点数争论是恒定的, 尝试将花费$( T) 。 尝试是独立的, 因此, 如果在失败时反复重试, 它会以$( T) 设定预期的步骤, 并且可能性很大。 但是, 重新尝试运行运行运行时间的尝试不是强制的, 。