Skip to content

Instantly share code, notes, and snippets.

@kubo39
Last active February 9, 2018 03:57
Show Gist options
  • Select an option

  • Save kubo39/e43688c56d60a64cd0dfac5da72026c0 to your computer and use it in GitHub Desktop.

Select an option

Save kubo39/e43688c56d60a64cd0dfac5da72026c0 to your computer and use it in GitHub Desktop.
$ spin -a lock.spin
$ gcc -o pan pan.c
$ ./pan
(Spin Version 6.4.6 -- 2 December 2016)
+ Partial Order Reduction
Full statespace search for:
never claim - (none specified)
assertion violations +
acceptance cycles - (not selected)
invalid end states +
State-vector 36 byte, depth reached 43, errors: 0
51 states, stored
94 states, matched
145 transitions (= stored+matched)
17 atomic steps
hash conflicts: 0 (resolved)
Stats on memory usage (in Megabytes):
0.003 equivalent memory usage for states (stored*(State-vector + overhead))
0.290 actual memory usage for states
128.000 memory used for hash table (-w24)
0.534 memory used for DFS stack (-m10000)
128.730 total actual memory usage
unreached in proctype locker
lock.spin:29, state 21, "-end-"
(1 of 21 states)
pan: elapsed time 0 seconds
bit mutex = 0;
int sum;
inline lock() {
do
:: 1 -> atomic {
if
:: mutex == 0
sum++
mutex = 1
sum--
break
:: else
fi
}
od
}
inline unlock() {
mutex = 0
}
active [3] proctype locker() {
do
:: lock()
unlock()
od
}
@kubo39
Copy link
Author

kubo39 commented Feb 9, 2018

proctype側のelseは到達しないと指摘。たしかにinline lockの 1 があるのでここにはこないなあ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment