Revert "ticketlock model: state-space simplication"
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Oct 2012 04:12:03 +0000 (00:12 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Oct 2012 04:12:03 +0000 (00:12 -0400)
This reverts commit d149fa02aaafa08c2d02712afd3cbbbc5f8d5f67.

Need to study impact on progress.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ticketlock/mem-progress.spin
ticketlock/mem.spin

index b7395413dea110b4006e50313168579b9eebcbea..dad43a45062a90e307b9b00c44d0eafe66bc49d3 100644 (file)
@@ -45,8 +45,15 @@ inline spin_lock(lock, ticket)
                lock = lock + HIGH_HALF_INC;    /* overflow expected */
        }
 
-       /* busy-wait */
-       LOW_HALF(lock) == ticket -> 1;
+       do
+       :: 1 ->
+               if
+               :: (LOW_HALF(lock) == ticket) ->
+                       break;
+               :: else ->
+                       skip;
+               fi;
+       od;
 }
 
 inline spin_unlock(lock)
@@ -59,9 +66,9 @@ proctype proc_A()
        byte ticket;
 
        do
-       :: 
-               spin_lock(lock, ticket);
+       :: 1 ->
 progress_A:
+               spin_lock(lock, ticket);
                refcount = refcount + 1;
                refcount = refcount - 1;
                spin_unlock(lock);
@@ -73,7 +80,8 @@ proctype proc_B()
        byte ticket;
 
        do
-       ::      spin_lock(lock, ticket);
+       :: 1 ->
+               spin_lock(lock, ticket);
                refcount = refcount + 1;
                refcount = refcount - 1;
                spin_unlock(lock);
index 59acfcf054dbb5ac1ae7ad556a315c9b31da88ce..445ee9a6d4193da200ebbf810d2aeb91088b871a 100644 (file)
@@ -44,8 +44,15 @@ inline spin_lock(lock, ticket)
                lock = lock + HIGH_HALF_INC;    /* overflow expected */
        }
 
-       /* busy-wait */
-       LOW_HALF(lock) == ticket -> 1;
+       do
+       :: 1 ->
+               if
+               :: (LOW_HALF(lock) == ticket) ->
+                       break;
+               :: else ->
+                       skip;
+               fi;
+       od;
 }
 
 inline spin_unlock(lock)
@@ -58,7 +65,8 @@ proctype proc_X()
        byte ticket;
 
        do
-       ::      spin_lock(lock, ticket);
+       :: 1->
+               spin_lock(lock, ticket);
                refcount = refcount + 1;
                refcount = refcount - 1;
                spin_unlock(lock);
This page took 0.026955 seconds and 4 git commands to generate.