Verifying Asynchronous programs with nested locks K Narayan Kumar - - PowerPoint PPT Presentation

verifying asynchronous programs with nested locks
SMART_READER_LITE
LIVE PREVIEW

Verifying Asynchronous programs with nested locks K Narayan Kumar - - PowerPoint PPT Presentation

Verifying Asynchronous programs with nested locks K Narayan Kumar CMI, Chennai Joint work with M.F. Atig A. Bouajjani Prakash Saivasan Programs with Locks: A collection of processes executing concurrently. A finite set of Locks


slide-1
SLIDE 1

Verifying Asynchronous programs with nested locks

K Narayan Kumar CMI, Chennai

Joint work with

  • M.F. Atig
  • A. Bouajjani
  • Prakash Saivasan
slide-2
SLIDE 2

Programs with Locks:

A collection of processes executing concurrently. A finite set of Locks

Proc-1 Proc-2 Proc-3

slide-3
SLIDE 3

Programs with Locks:

A collection of processes executing concurrently. A finite set of Locks Processes may take locks that are available and release locks that they hold.

Proc-1 Proc-2 Proc-3

slide-4
SLIDE 4

Programs with Locks:

Our processes will be recursive processes (over finite data domains) Modelled as Pushdown Systems

slide-5
SLIDE 5

Why Locks

Useful coordination mechanism. Can be built with protocols over shared memory. Usually supported by hardware. Available in many programming languages …

slide-6
SLIDE 6

How good are they? Can processes “synchronize” using just locks?

Why Locks

Useful coordination mechanism. Can be built with protocols over shared memory. Usually supported by hardware. Available in many programming languages …

slide-7
SLIDE 7

Synchronizing via Locks

Proc-1 Proc-2

slide-8
SLIDE 8

Synchronizing via Locks

Proc-1 Proc-2

slide-9
SLIDE 9

Synchronizing via Locks

Proc-1 Proc-2

slide-10
SLIDE 10

Synchronizing via Locks

Proc-1 Proc-2

slide-11
SLIDE 11

Synchronizing via Locks

Proc-1 Proc-2 x

slide-12
SLIDE 12

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-13
SLIDE 13

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-14
SLIDE 14

Synchronizing via Locks

Proc-1 Proc-2 x x

Locks Exchanged.

slide-15
SLIDE 15

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-16
SLIDE 16

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-17
SLIDE 17

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-18
SLIDE 18

Synchronizing via Locks

Proc-1 Proc-2 x x

slide-19
SLIDE 19

Synchronizing via Locks

Proc-1 Proc-2 x x x

slide-20
SLIDE 20

Synchronizing via Locks

Proc-1 Proc-2 x x x x

slide-21
SLIDE 21

Synchronizing via Locks

Proc-1 Proc-2 x x x x

slide-22
SLIDE 22

Synchronizing via Locks

Proc-1 Proc-2 x x x x

Locking not well-nested

slide-23
SLIDE 23

Synchronizing via Locks

Proc-1 Proc-2 x x x x

slide-24
SLIDE 24

Synchronizing via Locks

Proc-1 Proc-2 x x x x

slide-25
SLIDE 25

Synchronizing via Locks

Proc-1 Proc-2 x x x x

Chaining of locks. Unboundedly long chains.

slide-26
SLIDE 26

The control state reachability problem asks if a given global state can be reached from the initial configuration

Reachability:

Reachability problem for a (even two) recursive programs (PDS) with locks is undecidable.

Ramalingam TOPLAS 2000, Kahlon,Ivancic,Gupta CAV05

slide-27
SLIDE 27

What if we need all locks to be free at the beginning?

Initial Condition on Locks:

A somewhat more elaborate protocol with additional locks works.

Kahlon,Ivancic,Gupta CAV05

slide-28
SLIDE 28

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a a a b b b

slide-29
SLIDE 29

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a a a b b b x

slide-30
SLIDE 30

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a a a b b b x x

slide-31
SLIDE 31

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a a b b b x x a

slide-32
SLIDE 32

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a a b b x x a b

slide-33
SLIDE 33

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b b x x a a b x

slide-34
SLIDE 34

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x

slide-35
SLIDE 35

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x x

slide-36
SLIDE 36

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x x x

slide-37
SLIDE 37

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x x x x

slide-38
SLIDE 38

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x x x x x

slide-39
SLIDE 39

Initializing the Locks:

Kahlon,Ivancic,Gupta CAV05

a b x x a a b b x x x x x x

simulation simulation

slide-40
SLIDE 40

Decidable Underapproximations:

Nested Locking Locks are taken and released by each process in well-nested (last in first out/stack-like) manner

Kahlon,Ivancic,Gupta CAV05

slide-41
SLIDE 41

Decidable Underapproximations:

Nested Locking Locks are taken and released by each process in well-nested (last in first out/stack-like) manner

Kahlon,Ivancic,Gupta CAV05

x x

The well-nested assumption is per process (not global).

slide-42
SLIDE 42

Decidable Underapproximations:

Nested Locking Locks are taken and released by each process in well-nested (last in first out/stack-like) manner

Kahlon,Ivancic,Gupta CAV05

x x

The well-nested assumption is per process (not global). More on nested locking later …

slide-43
SLIDE 43

Decidable Underapproximations:

Bounded Lock Chains Lock chaining is permitted but there is a priori bound on length of such chains.

Kahlon LICS09

x x

A length 4 lock-chained run

slide-44
SLIDE 44

Recursive Programs with Locks

slide-45
SLIDE 45

Recursive Programs with Locks

slide-46
SLIDE 46

Recursive Programs with Locks

Locks taken in procedure may be released after the procedure terminates

slide-47
SLIDE 47

Recursive Programs with Locks

Procedures may return locks they did not take

slide-48
SLIDE 48

Contextual Locking

Contextual Locking Locks taken by a procedure call are returned during the execution

  • f that very procedure call.

Chadha,Madhusudan,Vishwanathan TACAS12

Reachability is decidable for 2 processes under contextual locking

Chadha, Madhusudan, Vishwanathan TACAS12 Bonnet, Chadha, Madhusudan, Viswanathan LMCS 2013

slide-49
SLIDE 49

Sequentializing the runs:

x x x x 1 2 x x x x x x x x x x x x

slide-50
SLIDE 50

Sequentializing the runs:

x x x x 1 2 L L x x x x x x x x x x x x

slide-51
SLIDE 51

Sequentializing the runs:

x x x x 1 2 L L

At least L

x x x x x x x x x x x x

slide-52
SLIDE 52

Sequentializing the runs:

x x x x 1 2 L L

At least L

x x x x x x x x x x x x

slide-53
SLIDE 53

Sequentializing the runs:

x x x x 1 2 L L

At least L

x x x x x x x x x x x x

slide-54
SLIDE 54

Sequentializing the runs:

x x x x 1 2 L L

At least L

x x x x x x x x x x x x More locks Available

slide-55
SLIDE 55

Sequentializing the runs:

x x x x 1 2 L L

At least L

x x x x x x x x x x x x More locks Available More locks Available

slide-56
SLIDE 56

Contextual Locking: 2 processes

Contextual Locking with 2 processes It suffices to consider runs where the procedure calls of the two processes are also well-nested. Can be simulated by a single PDS. This does not work if there are 3 processes or more.

Chadha,Madhusudan,Vishwanathan TACAS12

slide-57
SLIDE 57

Contextual Locking: >2 processes

The reachability problem for any number of pushdown systems synchronising via contextual locks is decidable.

Lammich, Muller-Olm, Seidl, Werner SAS13

Stack height bounding argument.

slide-58
SLIDE 58

m m - |L| (|Q||𝚫|)2

Last time First time

m-i

Stack height bounding:

slide-59
SLIDE 59

m m-i p q p q m - |L| (|Q||𝚫|)2

Stack height bounding…

slide-60
SLIDE 60

m m-i p,X q,X m - |L| (|Q||𝚫|)2

Stack height bounding…

slide-61
SLIDE 61

m m-i p,X q,X p,X q,X m - |L| (|Q||𝚫|)2

Stack height bounding…

slide-62
SLIDE 62

m m-i p,X q,X p,X q,X m - |L| (|Q||𝚫|)2

Stack height bounding…

Contextual Locking

slide-63
SLIDE 63

m m-i p,X q,X p,X q,X m - |L| (|Q||𝚫|)2 _.X _.X _.X

Stack height bounding…

Contextual Locking

slide-64
SLIDE 64

m m-i p,X q,X p,X q,X m - |L| (|Q||𝚫|)2 _.X _.X _.X _.X _.X _.X

Stack height bounding…

Contextual Locking

slide-65
SLIDE 65

m p,X q,X p,X q,X

Stack height bounding…

m - |L| (|Q||𝚫|)2

slide-66
SLIDE 66

p q

Stack height bounding…

slide-67
SLIDE 67

m p,X q,X p,X q,X

Stack height bounding…

m - |L| (|Q||𝚫|)2

slide-68
SLIDE 68

m p,X q,X p,X q,X

Stack height bounding…

m - |L| (|Q||𝚫|)2

slide-69
SLIDE 69

m p,X q,X p,X q,X

Stack height bounding…

More locks available for other processes below

m - |L| (|Q||𝚫|)2

slide-70
SLIDE 70

Contextual Locking: >2 processes

The reachability problem for any number of pushdown systems synchronising via contextual locks is decidable. Exponential (in states, stack alphabet, locks) length paths suffice. In PSPACE.

Lammich, Muller-Olm, Seidl, Werner SAS13

Extension to systems with Dynamic thread creation.

slide-71
SLIDE 71

Proc one() { < …. > call function(); async-call function(); }

Asynchronous programs:

Sen and Vishwanathan CAV06, Ganty and Majumdar TOPLAS12 …,

slide-72
SLIDE 72

Proc one() { < …. > call function(); async-call function(); }

Asynchronous programs:

Recursive programs with option to invoke asynchronous calls. The asynchronous calls are stored as tasks that can be retrieved later and executed The stored tasks have no specific

  • rder.

The tasks are executed atomically when there are no other pending calls.

Sen and Vishwanathan CAV06, Ganty and Majumdar TOPLAS12 …,

slide-73
SLIDE 73

Proc one() { < …. > call function(); async-call function(); }

Asynchronous programs:

Recursive programs with option to invoke asynchronous calls. The asynchronous calls are stored as tasks that can be retrieved later and executed The stored tasks have no specific

  • rder.

The tasks are executed atomically when there are no other pending calls.

Sen and Vishwanathan CAV06, Ganty and Majumdar TOPLAS12 …,

Modeled as a PDS augmented with a multi-set. (MPDS)

slide-74
SLIDE 74

Decidability:

Control state reachability for pushdown systems equipped with a multi-set is EXPSPACE-Complete

slide-75
SLIDE 75

Decidability:

Control state reachability for pushdown systems equipped with a multi-set is EXPSPACE-Complete

Sen and Vishwanathan CAV06 Atig, Bouajjani, Touili FSTTCS08 Ganty and Majumdar TOPLAS12

slide-76
SLIDE 76

Multi-threaded version:

Thread-1 Thread-2 Thread-4 Thread-3

slide-77
SLIDE 77

Multi-threaded version:

Thread-1 Thread-2 Thread-4 Thread-3

Programs with multiple threads running in parallel

slide-78
SLIDE 78

Multi-threaded version:

Thread-1 Thread-2 Thread-4 Thread-3

Task Task Task Task

Programs with multiple threads running in parallel Threads can either make a synchronous call or an asynchronous call by delegating it to some thread

slide-79
SLIDE 79

Multi-threaded version:

Thread-1 Thread-2 Thread-4 Thread-3

Task Task Task Task

Programs with multiple threads running in parallel Threads can either make a synchronous call or an asynchronous call by delegating it to some thread Threads have unbounded unordered buffers to store the tasks

slide-80
SLIDE 80

Communication:

Locks Thread-1 Thread-2 Thread-4 Thread-3

Task Task Task Task

slide-81
SLIDE 81

Communication:

Locks

We consider in asynchronous programs synchronising through locks

Thread-1 Thread-2 Thread-4 Thread-3

Task Task Task Task

slide-82
SLIDE 82

Asynchronous programs + Locks:

Pushdown systems with Multi-sets to hold tasks A finite set of global locks

1 2

Multi set Multi set

slide-83
SLIDE 83

1 2 3 4

Pushdown

  • ver Σ

Pushdown

  • ver Σ

Reduce intersection of two pushdown systems

Undecidability under nested locking

4 threads along with two locks and set

  • f tasks

l1 l2

= Σ ∪ {l, r}

+

The set of tasks is the alphabet of pushdown systems along with two additional tasks

1 2 3 4

slide-84
SLIDE 84

Simulation of a move:

1 2

We will show how to simulate a single move of each of the pushdown systems

l1 l1

slide-85
SLIDE 85

Simulation of a move:

1 2 l1 l1

The Simulation starts with process 3 holding l1

slide-86
SLIDE 86

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2

Process 1 and 2 test lock l2

slide-87
SLIDE 87

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2

Process 1 and 2 guess an letter and simulate the move

slide-88
SLIDE 88

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2 2

Process 1 and 2 sends the guessed letter to 3

slide-89
SLIDE 89

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2

Process 3 reads and verifies that the letters match

slide-90
SLIDE 90

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2 1

Process 3 requests 4 to hold lock l2

slide-91
SLIDE 91

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2 l2 l2

Process 4 reads the request and holds lock l2

slide-92
SLIDE 92

Simulation of a move:

1 2 l1 l1 l2 l2 l2 l2 l2 l2 1

Process 4 reads the request and holds lock l2

slide-93
SLIDE 93

Simulation of a move:

1 2 l1 l2 l2 l1 l2 l2 l2 l2

Process process 3 releases l1 on learning l2 is taken

slide-94
SLIDE 94

Simulation of a move:

1 2 l1 l2 l2 l1 l2 l2 l2 l2 l1 l1 l1 l1

Process 1 and 2 tests lock l1

slide-95
SLIDE 95

Simulation of a move:

1 2 l1 l2 l2 l1 l2 l2 l2 l2 l1 l1 l1 l1 l1 l1

Process 3 retakes lock l1 and asks 4 to release l2

slide-96
SLIDE 96

Simulation of a move:

1 2 l1 l2 l1 l2 l2 l2 l2 l1 l1 l1 l1 l1 l2 l1

Process 3 retakes lock l1 and asks 4 to release l2

slide-97
SLIDE 97

Locks can be held only by task. That is, locks are held only when the stack is not empty

Task locking restriction:

slide-98
SLIDE 98

Phases of a thread:

slide-99
SLIDE 99

Phases of a thread:

Task Phases: Complete execution of one task

slide-100
SLIDE 100

Phases of a thread:

Task Phases: Complete execution of one task Boundary Phase: Initial part of a nonterminating task where all locks are returned

slide-101
SLIDE 101

Phases of a thread:

Task Phases: Complete execution of one task Boundary Phase: Initial part of a nonterminating task where all locks are returned Lock phases: Part of a nonterminating task that begins with a lock that is never returned, until the next such action.

slide-102
SLIDE 102

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

slide-103
SLIDE 103

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

1

slide-104
SLIDE 104

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1

slide-105
SLIDE 105

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3

slide-106
SLIDE 106

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4

slide-107
SLIDE 107

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5

slide-108
SLIDE 108

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5 6

slide-109
SLIDE 109

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5 6 7

slide-110
SLIDE 110

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5 6 7 8

slide-111
SLIDE 111

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5 6 7 8 9

slide-112
SLIDE 112

Sequentialisation Lemma:

Every reachable configuration can be reached via a run that is a sequence of phases (of the different threads). That is, phases can be executed atomically.

2 1 3 4 5 6 7 8 9

Order in which their first events occur suffices

slide-113
SLIDE 113

N-threads to 1-thread:

(Guess and) Simulate the phases of all the threads using a single thread.

slide-114
SLIDE 114

N-threads to 1-thread:

States have to be consistent across phases of a thread. Maintain states

slide-115
SLIDE 115

N-threads to 1-thread:

Tasks picked for thread i have to be “available” at thread i. States have to be consistent across phases of a thread. Maintain states

slide-116
SLIDE 116

N-threads to 1-thread:

Tasks picked for thread i have to be “available” at thread i.

  • Easy. Use single multiset, but now tasks are tagged with the

associated thread. States have to be consistent across phases of a thread. Maintain states

slide-117
SLIDE 117

N-threads to 1-thread:

Tasks picked for thread i have to be “available” at thread i. Locks should be handled correctly (taken only when available …)

  • Easy. Use single multiset, but now tasks are tagged with the

associated thread. States have to be consistent across phases of a thread. Maintain states

slide-118
SLIDE 118

N-threads to 1-thread:

Tasks picked for thread i have to be “available” at thread i. Locks should be handled correctly (taken only when available …) Handle multiple pushdown stores

  • Easy. Use single multiset, but now tasks are tagged with the

associated thread. States have to be consistent across phases of a thread. Maintain states

slide-119
SLIDE 119

N-threads to 1-thread: locks

slide-120
SLIDE 120

N-threads to 1-thread: locks

Lock phases impose restrictions on availability of locks to future phases.

slide-121
SLIDE 121

N-threads to 1-thread: locks

Lock phases impose restrictions on availability of locks to future phases. Maintain information on availability of locks

slide-122
SLIDE 122

N-threads to 1-thread: stacks

slide-123
SLIDE 123

N-threads to 1-thread: stacks

slide-124
SLIDE 124

N-threads to 1-thread: stacks

Multiple stacks have to be maintained simultaneously.

slide-125
SLIDE 125

Segments of phases:

i i

A task phase of thread i A lock phase of thread i with lock

i

Boundary phase of thread i

1 2 3 3 1 2 3 1 2 2 3 1 1 3 4 3 3

1 2 3 4 5

Segment 0 — only task phases Segment i+1 — begins with boundary or lock phase, rest are task phases.

slide-126
SLIDE 126

Segments of phases:

i i

A task phase of thread i A lock phase of thread i with lock

i

Boundary phase of thread i

1 2 3 3 1 2 3 1 2 2 3 1 1 3 4 3 3

1 2 3 4 5

Segment 0 — only task phases Segment i+1 — begins with boundary or lock phase, rest are task phases.

Number of segments is bounded by locks + threads

slide-127
SLIDE 127

Guiding Sequences:

1 2 3 3 1 2 3 1 2 2 3 1 1 3 4 3 3

1 2 3 4 5

2 2 2 1 2

slide-128
SLIDE 128

Guiding Sequences:

1 2 3 3 1 2 3 1 2 2 3 1 1 3 4 3 3

1 2 3 4 5

2 2 2 1 2

A sequence identifying the first element of each segment

slide-129
SLIDE 129

Simulation with a single stack:

2 2 2 1 2

Seg No = 0

slide-130
SLIDE 130

Simulation with a single stack:

2 2 2 1 2

any task phase

Seg No = 0

slide-131
SLIDE 131

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

a phase of 2 that takes lock a phase of 2 that takes lock a phase of 2 that takes lock

Seg No = 1

slide-132
SLIDE 132

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock a phase of 2 that takes lock a phase of 2 that takes lock

Seg No = 1

slide-133
SLIDE 133

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock a phase of 2 that takes lock

Seg No = 2

slide-134
SLIDE 134

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock

Seg No = 3

slide-135
SLIDE 135

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a boundary phase

  • f thread 1

a phase of 2 that takes lock

Seg No = 4

slide-136
SLIDE 136

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a boundary phase

  • f thread 1

task phases, other than thread 2,1 Lock prohibited a phase of 2 that takes lock

Seg No = 4

slide-137
SLIDE 137

Simulation with a single stack:

2 2 2 1 2

any task phase a boundary phase

  • f thread 2

task phases, other than thread 2 a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a phase of 2 that takes lock task phases, other than thread 2. Lock prohibited a boundary phase

  • f thread 1

task phases, other than thread 2,1 Lock prohibited a phase of 2 that takes lock task phases, other than thread 2,1 prohibited

Seg No = 5

slide-138
SLIDE 138

Complexity:

For a given guiding sequence Exponential blow up due to product of state spaces

slide-139
SLIDE 139

Complexity:

For a given guiding sequence Exponential blow up due to product of state spaces

Maintain the local states in the multiset

slide-140
SLIDE 140

Complexity:

For a given guiding sequence Exponential blow up due to product of state spaces

Maintain the local states in the multiset

Reachability via runs consistent with a given guiding sequence reduces to a polynomially larger 1-Thread system.

slide-141
SLIDE 141

Complexity …

For a given guiding sequence There are only exponentially many guiding sequences

slide-142
SLIDE 142

Complexity …

For a given guiding sequence

Reachability via runs consistent with a given guiding sequence is in EXPSPACE.

There are only exponentially many guiding sequences

Theorem: Reachability for Asynchronous programs with locks under well-nested, task locking is EXPSPACE-Complete

slide-143
SLIDE 143

Complexity: underapproximation

What if we also want to verify that the system uses nested locking? Exponential blow up due to set of locks to be maintained. Locks are accessed when the stack is not empty, so can’t be simply moved to the multi-set. Using Parikh’s theorem transform this into FA with multi-sets with 2-EXP number of states, but same multi-set alphabet as in the input. Treat as a VASS with 2-EXP number of states and polynomial number of places. Yen-Rosier show that coverability for VASS can be solved space logarithmic in the number of states and exponential in the number of places.

slide-144
SLIDE 144

Stateless task scheduling:

Each thread may schedule a new task only from a fixed local state.

Tasks cannot “communicate” via local state of threads A thread just schedules and runs tasks.

slide-145
SLIDE 145

Stateless task scheduling:

Theorem: Reachability for Asynchronous programs with locks under state-less scheduling, well-nested locks and task locking is NP-Complete

slide-146
SLIDE 146

Stateless task scheduling:

Theorem: Reachability for Asynchronous programs with locks under state-less scheduling, well-nested locks and task locking is NP-Complete

A polynomial bound on the number of tasks that need to be scheduled to reach any (reachable) state.

slide-147
SLIDE 147

Bounding the number of tasks

slide-148
SLIDE 148

Bounding the number of tasks

slide-149
SLIDE 149

Bounding the number of tasks

slide-150
SLIDE 150

Bounding the number of tasks

Number of branching points bounded by threads

slide-151
SLIDE 151

Bounding Path length

slide-152
SLIDE 152

Bounding Path length

No Branching

slide-153
SLIDE 153

Bounding Path length

slide-154
SLIDE 154

Bounding Path length

Path length bounded by Poly(threads, tasks) Width also bounded by threads.

slide-155
SLIDE 155

Stateless task scheduling:

slide-156
SLIDE 156

Stateless task scheduling:

Only a polynomial bound on the number of tasks that need to be scheduled.

slide-157
SLIDE 157

Stateless task scheduling:

Only a polynomial bound on the number of tasks that need to be scheduled. 1-Thread simulation can work with the same number of tasks.

slide-158
SLIDE 158

Stateless task scheduling:

Only a polynomial bound on the number of tasks that need to be scheduled. 1-Thread simulation can work with the same number of tasks.

Complexity of emptiness of Asynchronous Programs with at most polynomial number of operations on the multi-set.

slide-159
SLIDE 159

Stateless task scheduling:

Only a polynomial bound on the number of tasks that need to be scheduled. 1-Thread simulation can work with the same number of tasks.

Complexity of emptiness of Asynchronous Programs with at most polynomial number of operations on the multi-set.

Guess and write down a consistent sequence of Multi-set

  • perations (consistent: add >= remove at each point for each

task)

slide-160
SLIDE 160

Stateless task scheduling:

Only a polynomial bound on the number of tasks that need to be scheduled. 1-Thread simulation can work with the same number of tasks.

Complexity of emptiness of Asynchronous Programs with at most polynomial number of operations on the multi-set.

Guess and write down a consistent sequence of Multi-set

  • perations (consistent: add >= remove at each point for each

task) Simulate the Asynchronous program as a pushdown on this input.

slide-161
SLIDE 161

Stateless task scheduling:

Theorem: Reachability for Asynchronous programs with locks under state-less scheduling, well-nested locks and task locking is NP-Complete

slide-162
SLIDE 162

Stateless task scheduling:

Theorem: Reachability for Asynchronous programs with locks under state-less scheduling, well-nested locks and task locking is NP-Complete

Lower-bound —- reduction from SAT. Take locks to decide on valuation (taking lock x if x = False) Cycle through clauses and check that at least one literal is true.

slide-163
SLIDE 163

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable.

slide-164
SLIDE 164

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete.

slide-165
SLIDE 165

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete. Stateless scheduling is decidable in NP .

slide-166
SLIDE 166

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete. Stateless scheduling is decidable in NP .

Possible Extensions

slide-167
SLIDE 167

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete. Stateless scheduling is decidable in NP .

Possible Extensions

Locks + Shared memory. Reasonable restrictions for decidability?

slide-168
SLIDE 168

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete. Stateless scheduling is decidable in NP .

Possible Extensions

Locks + Shared memory. Reasonable restrictions for decidability? Other locking subclasses: bounded lock chains, contextual locking

slide-169
SLIDE 169

Conclusion:

Asynchronous programs with nested locks: reachability is undecidable. Decidable under a further task locking restriction. EXPSPACE- Complete. Stateless scheduling is decidable in NP .

Thank you

Possible Extensions

Locks + Shared memory. Reasonable restrictions for decidability? Other locking subclasses: bounded lock chains, contextual locking