-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #629 from goblint/restart-sided-fuel
Incremental TD3: limit side-effected restarting using fuel
- Loading branch information
Showing
14 changed files
with
302 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; | ||
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
pthread_mutex_lock(&mutex2); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex2); | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
wrap(); | ||
pthread_join (id, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"incremental": { | ||
"restart": { | ||
"sided": { | ||
"enabled": true, | ||
"fuel": 2 | ||
}, | ||
"write-only": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- tests/incremental/11-restart/14-mutex-simple-wrap2.c | ||
+++ tests/incremental/11-restart/14-mutex-simple-wrap2.c | ||
@@ -7,15 +7,15 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
- myglobal=myglobal+1; // RACE! | ||
+ myglobal=myglobal+1; // NORACE | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
- pthread_mutex_lock(&mutex2); | ||
- myglobal=myglobal+1; // RACE! | ||
- pthread_mutex_unlock(&mutex2); | ||
+ pthread_mutex_lock(&mutex1); | ||
+ myglobal=myglobal+1; // NORACE | ||
+ pthread_mutex_unlock(&mutex1); | ||
} | ||
|
||
int main(void) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; | ||
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
pthread_mutex_lock(&mutex2); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex2); | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
wrap(); | ||
pthread_join (id, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"incremental": { | ||
"restart": { | ||
"sided": { | ||
"enabled": true, | ||
"fuel": 1 | ||
}, | ||
"write-only": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- tests/incremental/11-restart/15-mutex-simple-wrap1.c | ||
+++ tests/incremental/11-restart/15-mutex-simple-wrap1.c | ||
@@ -7,15 +7,15 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
- myglobal=myglobal+1; // RACE! | ||
+ myglobal=myglobal+1; // RACE (not enough fuel) | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
- pthread_mutex_lock(&mutex2); | ||
- myglobal=myglobal+1; // RACE! | ||
- pthread_mutex_unlock(&mutex2); | ||
+ pthread_mutex_lock(&mutex1); | ||
+ myglobal=myglobal+1; // RACE (not enough fuel) | ||
+ pthread_mutex_unlock(&mutex1); | ||
} | ||
|
||
int main(void) { |
27 changes: 27 additions & 0 deletions
27
tests/incremental/11-restart/16-mutex-simple-wrap1-global.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; | ||
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
pthread_mutex_lock(&mutex2); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex2); | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
wrap(); | ||
pthread_join (id, NULL); | ||
return 0; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/incremental/11-restart/16-mutex-simple-wrap1-global.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"incremental": { | ||
"restart": { | ||
"sided": { | ||
"enabled": true, | ||
"fuel": 1, | ||
"fuel-only-global": true | ||
}, | ||
"write-only": false | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/incremental/11-restart/16-mutex-simple-wrap1-global.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- tests/incremental/11-restart/16-mutex-simple-wrap1-global.c | ||
+++ tests/incremental/11-restart/16-mutex-simple-wrap1-global.c | ||
@@ -7,15 +7,15 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
- myglobal=myglobal+1; // RACE! | ||
+ myglobal=myglobal+1; // NORACE | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
void wrap() { | ||
- pthread_mutex_lock(&mutex2); | ||
- myglobal=myglobal+1; // RACE! | ||
- pthread_mutex_unlock(&mutex2); | ||
+ pthread_mutex_lock(&mutex1); | ||
+ myglobal=myglobal+1; // NORACE | ||
+ pthread_mutex_unlock(&mutex1); | ||
} | ||
|
||
int main(void) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; | ||
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
pthread_mutex_lock(&mutex1); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex1); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
pthread_mutex_lock(&mutex2); | ||
myglobal=myglobal+1; // RACE! | ||
pthread_mutex_unlock(&mutex2); | ||
pthread_join (id, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"incremental": { | ||
"restart": { | ||
"sided": { | ||
"enabled": true, | ||
"fuel": 1 | ||
}, | ||
"write-only": false | ||
} | ||
} | ||
} |
Oops, something went wrong.