Verification and Testing Flashcards

1
Q

Soundness

A

No incorrect programs are deemed correct ( ⇒ All errors are found)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Completeness

A

A correct program is deemed correct ( ⇒ no spurious errors)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Static verification

A

Consider program code, check
for all possible executions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Dynamic verification

A

Runtime verification of executions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Deadlocks

A

A deadlock is a circular wait

show themselves when a program hangs

hard to find because they often occur only with a specific scheduling

hard to reproduce

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Race conditions

A

two or more threads can access shared data and they try to change it at the same time

If the result of an execution depends on the execution order of two threads, one says that there is a race condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

data race

A
  1. Two threads access variable concurrently
  2. At least one access is write
  3. Nothing prevents simultaneous access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

gate lock

A

A gate lock prevents a deadlock by protecting the areas with lock reversal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Lock Tree Algorithm

A

Dynamic algorithm to find deadlocks

in a tree, keep track the order in which locks are
acquired and released; see if there are reversals

Limitations
• Works for deadlocks involving two threads only
• Works only for properly nested locks

T1
ALock
BLock
T2
BLock
ALock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Lock Tree Algorithm - steps

A

Build trees during runtime
– each tree has a current node
– If lock acquired create new child and move to it
– If node released, move up one level

After termination, analyze trees. Possible deadlock if

  1. T1 contains a node Li with ancestor Lj
  2. T2 tree contains a node Lj with ancestor Li
  3. There is no gate lock: node Lk which is an ancestor of Li in T1 and Lj in T2

A gate lock is a lock that is

  1. an ancestor of Li and Lj in T1 and
  2. an ancestor of Li and Lj in T2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Eraser

A

finds possible race conditions

Check locking behavior
For any shared data, is some lock always held on
access?
This condition is sufficient but not necessary for
correctness
Dynamic algorithm
– Computes locks held during one run
– May not find all problems
– May warn when no problem exists
– What it finds depends on the run!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is eraser better at finding race conditions than simple testing?

A

Little dependence on scheduling order: Can find bug in
one scheduling by executing another one: better
than testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Read-write locks

A
  • multiple simultaneous readers,
  • a write is never simultaneous with another read or write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Valgrind

A

suite of tools, adds shadow memory

V-bits: One byte to store whether each bit has a valid value

A-bit: One bit to store whether byte has been allocated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Purify

A

simpler version of valgrind

uses two bits of status per byte of memory

faster than valgrind, becaue only one bit per byte

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Logical gate symbols

A
17
Q

B(ounded)MC vs Concolic testing

A

BoundedMC tries all paths simultaneously
▪ Query: there is a path of length k to a bug
▪ Like breadth-first search: wide and shallow

Concolic tries one path at a time
▪ Query: this path (of length k) leads to a bug
▪ Like depth-first search: deep and narrow

18
Q

Java Path finder BFS vs DFS

A

BFS
•Finds shortest path to error
•Does not get stuck in infinite loop
•Typically uses more memory

DFS
•May not find error at all
•Often uses less memory

19
Q

Hoare triple

A

{P} S {Q}
P is the precondition
Q is the postcondition
S is a program
Meaning: if P holds before execution and S finishes, then Q holds afterwards.
Note: we prove partial correctness. If S runs forever, {P}S{Q} holds.

20
Q

Hoare Axioms

A