0

我们如何使用线程数对 SPIN 模型进行参数化?我正在使用标准的 SPIN 模型检查器。它有设置并行线程数的选项吗?我检查了参考,但没有发现任何有用的东西

4

1 回答 1

0

您可以使用运算符动态生成 Promela 进程run。因此,您可以迭代为:

#define TRY_COUNT 5
byte index = 0;
do
:: index == TRY_COUNT -> break
:: else -> index++; run theProcess()
od

您还可以定义一个文件,如:

active [TRY_COUNT] proctype foo () {
  printf ("PID: %d\n", _pid);
  assert (true)
}

init {
  assert (true)
}

然后运行 ​​SPIN 模拟:

$ spin -DTRY_COUNT=4 bar.pml
              PID: 2
      PID: 0
          PID: 1
                  PID: 3
5 processes created

或验证

$ spin -DTRY_COUNT=4 -a bar.pml
$ gcc -o bar pan.c
$ ./bar
hint: this search is more efficient if pan.c is compiled -DSAFETY

(Spin Version 6.3.2 -- 17 May 2014)
    + Partial Order Reduction
...
于 2015-01-19T16:28:17.807 回答