Gibbons and Korach studied a fundamental problem in 1997: given an observed sequence of reads and writes of a multi-threaded program, does there exist an interleaving which is sequentially consistent? Apart from applications in testing shared memory implementations, a procedure for this problem is employed in Dynamic Partial-Order-Reduction (DPOR) algorithms. The problem is known to be NP-hard even when different syntactic parameters are kept bounded. In this paper, we consider a restriction on the kind of interleaving required: does there exist a sequentially-consistent interleaving with at most π preemptions? Empirical evidence suggests that several bugs manifest within a few preemptive switches. This motivates us to investigate the problem under bounded preemptions. Our results exhibit a trichotomy: the problem lends to a polynomial-time algorithm for the class of single-writer programs where for each variable, there is a single thread writing to it; it becomes NP-hard for two-writer programs and finally, for three-writer programs, we get a conditional lower bound under the Exponential-Time-Hypothesis. When the number of preemptions π is not bounded, we show the problem to be W[1]-hard, and hence unlikely to be fixed-parameter-tractable with parameter π.
翻译:Gibbons和Korach在1997年研究了一个基本问题:给定一个多线程程序观测到的读写序列,是否存在一个顺序一致的交叉执行?除了在测试共享内存实现中的应用外,该问题的求解过程还用于动态偏序归约算法。已知即使在不同句法参数保持有界的情况下,该问题也是NP难的。本文考虑了一种对所需交叉执行类型的限制:是否存在最多包含π次抢占的顺序一致交叉执行?经验证据表明,多个程序错误会在少量抢占切换中显现。这促使我们研究有限抢占下的该问题。研究结果呈现出三分法:对于每个变量仅由单个线程写入的单写程序类,该问题存在多项式时间算法;对于双写程序,问题变为NP难;最后对于三写程序,我们基于指数时间假设得到了一个条件性下界。当抢占次数π无界时,我们证明该问题是W[1]难的,因此以π为参数时不太可能具有固定参数可解性。