verifying asynchronous programs with nested locks
play

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


  1. Multi-threaded version: Thread-1 Thread-2 Thread-3 Thread-4

  2. Multi-threaded version: Programs with multiple Thread-1 Thread-2 threads running in parallel Thread-3 Thread-4

  3. Multi-threaded version: Task Programs with multiple Thread-1 Thread-2 threads running in parallel Threads can either make a synchronous call or an Task Task asynchronous call by delegating it to some thread Thread-3 Thread-4 Task

  4. Multi-threaded version: Task Programs with multiple Thread-1 Thread-2 threads running in parallel Threads can either make a synchronous call or an Task Task asynchronous call by delegating it to some thread Threads have unbounded Thread-3 Thread-4 unordered buffers to store the tasks Task

  5. Communication: Task Thread-1 Thread-2 Task Locks Task Thread-3 Thread-4 Task

  6. Communication: Task Thread-1 Thread-2 Task Locks Task Thread-3 Thread-4 Task We consider in asynchronous programs synchronising through locks

  7. Asynchronous programs + Locks: Multi set Multi set Pushdown systems with 1 2 Multi-sets to hold tasks A finite set of global locks

  8. Undecidability under nested locking Reduce intersection of two pushdown Pushdown Pushdown ∩ systems over Σ over Σ ⇒ 4 threads along with two locks and set of tasks 1 2 3 4 The set of tasks is the alphabet of 2 3 4 1 pushdown systems along with two = Σ ∪ { l, r } additional tasks + l1 l2

  9. Simulation of a move: 0 0 0 1 0 0 0 2 l1 0 0 0 l1 0 0 0 We will show how to simulate a single move of each of the pushdown systems

  10. Simulation of a move: 0 0 0 1 0 0 0 2 l1 0 0 0 l1 0 0 0 The Simulation starts with process 3 holding l1

  11. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 0 0 l1 0 0 0 Process 1 and 2 test lock l2

  12. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 0 0 l1 0 0 0 Process 1 and 2 guess an letter and simulate the move

  13. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 2 0 0 l1 0 0 0 Process 1 and 2 sends the guessed letter to 3

  14. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 0 l1 0 0 0 0 Process 3 reads and verifies that the letters match

  15. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 0 l1 0 0 1 0 Process 3 requests 4 to hold lock l2

  16. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 0 l1 0 0 0 0 l2 l2 Process 4 reads the request and holds lock l2

  17. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 0 1 l1 0 0 0 0 l2 l2 Process 4 reads the request and holds lock l2

  18. Simulation of a move: l2 l2 0 0 0 1 l2 l2 0 0 0 2 l1 l1 0 0 0 0 0 0 l2 l2 Process process 3 releases l1 on learning l2 is taken

  19. Simulation of a move: l2 l2 l1 l1 0 0 0 1 l2 l2 l1 l1 0 0 0 2 l1 l1 0 0 0 0 0 0 l2 l2 Process 1 and 2 tests lock l1

  20. Simulation of a move: l2 l2 l1 l1 0 0 0 1 l2 l2 l1 l1 0 0 0 2 l1 l1 l1 0 0 0 l1 0 0 0 l2 l2 Process 3 retakes lock l1 and asks 4 to release l2

  21. Simulation of a move: l2 l2 l1 l1 0 0 0 1 l2 l2 l1 l1 0 0 0 2 l1 l1 l1 0 0 0 l1 0 0 0 l2 l2 Process 3 retakes lock l1 and asks 4 to release l2

  22. Task locking restriction: Locks can be held only by task. That is, locks are held only when the stack is not empty

  23. Phases of a thread:

  24. Phases of a thread: Task Phases: Complete execution of one task

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

Recommend


More recommend