Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ermenegildo Tomasco University of Southampton, UK Omar Inverso University of Southampton, UK Bernd Fischer Stellenbosch University, South Africa Salvatore.

Similar presentations


Presentation on theme: "Ermenegildo Tomasco University of Southampton, UK Omar Inverso University of Southampton, UK Bernd Fischer Stellenbosch University, South Africa Salvatore."— Presentation transcript:

1 Ermenegildo Tomasco University of Southampton, UK Omar Inverso University of Southampton, UK Bernd Fischer Stellenbosch University, South Africa Salvatore La Torre Università di Salerno, Italy Gennaro Parlato University of Southampton, UK MU-CSeq: Sequentialization of C Programs by Shared Memory Unwindings

2 Sequentialization of Concurrent Programs Basic Idea: convert concurrent programs into equivalent sequential programs

3 Sequentialization of Concurrent Programs Basic Idea: Mu-CSeq Approach: T ₁ ∥ T ₂ ↝ M ; T ̕₁ ; C ₁ ; T ̕₂ ; C ₂ –M makes consistent shared memory guess –checkers C ensure that threads T’ used memory consistently convert concurrent programs into equivalent sequential programs

4 Memory Unwinding xy... z “memory”

5 Memory Unwinding xy... z “memory” Guess and store sequence of individual write operations:

6 Memory Unwinding xy... z N “memory” pos Guess and store sequence of individual write operations:

7 Memory Unwinding xy... z N “memory” pos Guess and store sequence of individual write operations: add N copies of shared variables (“memory”) _memory[i,v] is value of v-th variable after i-th write

8 Memory Unwinding xy... z 1x 1y 2y 1z 2x var N thr “memory”“writes” pos Guess and store sequence of individual write operations: add N copies of shared variables (“memory”) _memory[i,v] is value of v-th variable after i-th write add array to record writes (“wirtes”) i-th write is by _thr[i], which has written to _var[i]

9 Memory Unwinding xy... z 1x 1y 2y 1z 2x var... next[0] N thr “memory”“writes” “barrier” pos Guess and store sequence of individual write operations: add N copies of shared variables (“memory”) _memory[i,v] is value of v-th variable after i-th write add array to record writes (“writes”) i-th write is by _thr[i], which has written to _var[i] add array to record validity of writes (“barrier”) next write (after i) by thread t is at _next[i,t] N next[K]... N+1 N 3 3 N... N+1

10 Basic Idea: Simulation simulate all executions compatible with guessed memory unwinding

11 Basic Idea: uses auxiliary variables – pos (current index into unwound memory) – thread (id of currently simulated thread) – end (guessed index of last write into unwound memory) Simulation simulate all executions compatible with guessed memory unwinding

12 Basic Idea: uses auxiliary variables – pos (current index into unwound memory) – thread (id of currently simulated thread) – end (guessed index of last write into unwound memory) every thread is translated into a function –simulation starts from main thread Simulation simulate all executions compatible with guessed memory unwinding

13 Basic Idea: uses auxiliary variables – pos (current index into unwound memory) – thread (id of currently simulated thread) – end (guessed index of last write into unwound memory) every thread is translated into a function –simulation starts from main thread each thread creation interrupts simulation of current thread –new thread is called with current value of pos Simulation simulate all executions compatible with guessed memory unwinding

14 Basic Idea: uses auxiliary variables – pos (current index into unwound memory) – thread (id of currently simulated thread) – end (guessed index of last write into unwound memory) every thread is translated into a function –simulation starts from main thread each thread creation interrupts simulation of current thread –new thread is called with current value of pos terminated threads must have completed their memory writes –pos > end Simulation simulate all executions compatible with guessed memory unwinding

15 Basic Idea: uses auxiliary variables – pos (current index into unwound memory) – thread (id of currently simulated thread) – end (guessed index of last write into unwound memory) every thread is translated into a function –simulation starts from main thread each thread creation interrupts simulation of current thread –new thread is called with current value of pos terminated threads must have completed their memory writes –pos > end old thread resumed with old memory position Simulation simulate all executions compatible with guessed memory unwinding

16 Basic Idea: every read / write is translated into a function –simulates valid access into unwound memory similar simulations for pthread functions Simulation simulate all executions compatible with guessed memory unwinding

17 Simulating reads and writes xy... z 1x 1y 2y 1z 2x var N thr int read(uint x) { uint jmp=*; assume(jmp>=pos && jmpend) return; return(_memory[pos, x]); } “memory”“writes” pos next[0] “barrier” N next[K]... N+1 N 3 3 N... N+1

18 Simulating reads and writes xy... z 1x 1y 2y 1z 2x var N thr int write(uint x, int val) { pos=next[pos,thread]; if(pos>end) return; assume( _var[pos]==x && _memory[pos,x]==val); } “memory”“writes” pos next[0] “barrier” N next[K]... N+1 N 3 3 N... N+1

19 CSeq framework Translation from P to P': constraint for the shared memory boilerplate code to simulate Read, Write and Pthread API backend-specific instrumentation sequential non- deterministic C program P'P' concurrent C program P true/false Mu-CSeq sequential BMC CBMC, ESBMC, LLBMC #writebackend#unwind

20 Thank You users.ecs.soton.ac.uk/gp4/cseq/cseq.html


Download ppt "Ermenegildo Tomasco University of Southampton, UK Omar Inverso University of Southampton, UK Bernd Fischer Stellenbosch University, South Africa Salvatore."

Similar presentations


Ads by Google