KISS: Keep it Simple and Sequential
A tool for finding bugs in concurrent programs Steffen Juilf Smolka
Technische Universität München
- 17. Juli 2012
- S. Smolka (TUM)
KISS: Keep it Simple and Sequential
- 17. Juli 2012
1
KISS: Keep it Simple and Sequential A tool for finding bugs in - - PowerPoint PPT Presentation
KISS: Keep it Simple and Sequential A tool for finding bugs in concurrent programs Steffen Juilf Smolka Technische Universitt Mnchen 17. Juli 2012 S. Smolka (TUM) KISS: Keep it Simple and Sequential 17. Juli 2012 1 Overview Motivation
Technische Universität München
KISS: Keep it Simple and Sequential
1
1
2
3
KISS: Keep it Simple and Sequential
2
KISS: Keep it Simple and Sequential
3
KISS: Keep it Simple and Sequential
4
KISS: Keep it Simple and Sequential
4
KISS: Keep it Simple and Sequential
5
// global variables usb_driver driver; boolean is_running; boolean is_in_use; void main () { driver = init (); is_running = true; is_in_use = false; async(thrA ); async(thrB ); }
void thrA () { if(is_running ){ is_in_use = true; // use driver ... . . . is_in_use = false; } }
void thrB () { assume (! is_in_use ); is_running = false; // clean up ... free(driver ); . . . }
KISS: Keep it Simple and Sequential
6
// global variables usb_driver driver; boolean is_running; boolean is_in_use; void main () { driver = init (); is_running = true; is_in_use = false; async(thrA ); async(thrB ); }
void thrA () { if(is_running ){ is_in_use = true; // use driver ... . . . assert( is_running ); is_in_use = false; } }
void thrB () { assume (! is_in_use ); is_running = false; // clean up ... free(driver ); . . . assert (! is_in_use ); }
KISS: Keep it Simple and Sequential
7
// global variables usb_driver driver; boolean is_running; boolean is_in_use; void main () { driver = init (); is_running = true; is_in_use = false; async(thrA ); async(thrB ); }
void thrA () { if(is_running ){ is_in_use = true; // use driver ... . . . assert( is_running ); is_in_use = false; } }
void thrB () { assume (! is_in_use ); is_running = false; // clean up ... free(driver ); . . . assert (! is_in_use ); }
KISS: Keep it Simple and Sequential
8
KISS: Keep it Simple and Sequential
9
KISS: Keep it Simple and Sequential
10
KISS: Keep it Simple and Sequential
10
KISS: Keep it Simple and Sequential
10
KISS: Keep it Simple and Sequential
11
1
2
3
KISS: Keep it Simple and Sequential
12
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
1 void
main1 () {
2
f();
3
exit (0);
4 } 5 6 void f() { 7
g();
8
return;
9 } 10 11 void g() { 12
return;
13 }
1 void
mainN () {
2
foo;
3
bar;
4
foobar;
5 }
KISS: Keep it Simple and Sequential
13
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
14
KISS: Keep it Simple and Sequential
15
Set ts = Set.init (); usb_driver driver; boolean is_running ; boolean is_in_use; void main () { driver = init (); is_running = true; is_in_use = false; async(thrA ); async(thrB ); }
void thrA () { if(is_running ){ is_in_use = true; . . . is_in_use = false; } } CODE sched_nondet_nr_of_thrs (); if($) return ;~0@
KISS: Keep it Simple and Sequential
16
Set ts = Set.init (); usb_driver driver; boolean is_running ; boolean is_in_use; void main () { driver = init (); is_running = true; is_in_use = false; async(thrA ); async(thrB ); }
void thrA () { if(is_running ){ is_in_use = true; . . . is_in_use = false; } } CODE sched_nondet_nr_of_thrs (); if($) return ;~0@
KISS: Keep it Simple and Sequential
16
Set ts = Set.init (); usb_driver driver; boolean is_running ; boolean is_in_use; void main () { CODE driver = init (); CODE is_running = true; CODE is_in_use = false; CODE ts.add(thrA ); CODE ts.add(thrA ); }
void thrA () { CODE if(is_running ){ CODE is_in_use = true; . . . CODE is_in_use = false; } } CODE ≡ sched_nondet_nr_of_thrs (); if($) return;
KISS: Keep it Simple and Sequential
17
Set ts = Set.init (); usb_driver driver; boolean is_running ; boolean is_in_use; void main () { CODE driver = init (); CODE is_running = true; CODE is_in_use = false; CODE ts.add(thrA ); CODE ts.add(thrA ); }
void thrA () { CODE if(is_running ){ CODE is_in_use = true; . . . CODE is_in_use = false; } } CODE ≡ sched_nondet_nr_of_thrs (); if($) return;
KISS: Keep it Simple and Sequential
17
Set ts = Set.init(k); usb_driver driver; boolean is_running ; boolean is_in_use; void main () { CODE driver = init (); CODE is_running = true; CODE is_in_use = false; CODE if(ts.size <k) ts.add(thrA ); else thrA (); CODE if(ts.size <k) ts.add(thrB ); else thrB (); }
void thrA () { CODE if(is_running ){ CODE is_in_use = true; . . . CODE is_in_use = false; } } CODE ≡ sched_nondet_nr_of_thrs (); if($) return;
KISS: Keep it Simple and Sequential
18
1
2
KISS: Keep it Simple and Sequential
19
void g() { . . . x = h(); sched_nondet_nr_of_thrs (); . . . } void h() { . . . sched_nondet_nr_of_thrs (); if($) return; foo; . . . }
KISS: Keep it Simple and Sequential
20
void g() { . . . x = h(); sched_nondet_nr_of_thrs (); . . . } void h() { . . . sched_nondet_nr_of_thrs (); if($) return; foo; . . . }
KISS: Keep it Simple and Sequential
20
bool raise = false; void g() { . . . x = h(); if(raise) return; sched_nondet_nr_of_thrs (); . . . } void h() { . . . sched_nondet_nr_of_thrs (); if($) { raise = true; return; } foo; . . . }
KISS: Keep it Simple and Sequential
21
bool raise = false; void g() { . . . x = h(); if(raise) return; sched_nondet_nr_of_thrs (); . . . } void h() { . . . sched_nondet_nr_of_thrs (); if($) { raise = true; return; } foo; . . . }
KISS: Keep it Simple and Sequential
21
bool raise = false; void g() { . . . x = h(); if(raise) return; sched_nondet_nr_of_thrs (); . . . } void h() { . . . sched_nondet_nr_of_thrs (); if($) { raise = true; return; } foo; . . . }
KISS: Keep it Simple and Sequential
21
KISS: Keep it Simple and Sequential
22
1
2
3
KISS: Keep it Simple and Sequential
23
KISS: Keep it Simple and Sequential
24
KISS: Keep it Simple and Sequential
25
KISS: Keep it Simple and Sequential
25
KISS: Keep it Simple and Sequential
26
KISS: Keep it Simple and Sequential
27