SPIN模型检查器中的多线程

时间:2014-12-05 18:24:45

标签: multithreading spin-rdf

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

1 个答案:

答案 0 :(得分:0)

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

#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
...