1 / 17

Verification of a Concurrent Priority Queue

Verification of a Concurrent Priority Queue. Bart Verzijlenberg. Agenda. Brief Review Verification Overview Verification Results Errors Further Work Conclusion. Brief Review. Priority Queue Lock-free Relies on atomic Compare and Swap operations. Algorithm Review.

Download Presentation

Verification of a Concurrent Priority Queue

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Verification of a Concurrent Priority Queue Bart Verzijlenberg

  2. Agenda • Brief Review • Verification Overview • Verification Results • Errors • Further Work • Conclusion

  3. Brief Review • Priority Queue • Lock-free • Relies on atomic Compare and Swap operations

  4. Algorithm Review • The algorithm uses the Skip-List data structure • Extends the Skip-List for concurrent use • The Skip-List is sorted on the priority of the nodes • The algorithm is lock-free • No blocking • Prevent dead locks • Always progress by at least one operation • Risk of starvation

  5. Algorithm ReviewSkip-List • Multi-layer linked list • H forward pointers for a node of height h • Each pointer i points to the next node with a height of at least i

  6. Inserting in a Skip-List Inserting 17 in the list

  7. Verification Overview • Java Path Finder • Breadth-First Search • Depth-First Search • Modified JPF script • Increased stack size to 1536Mb • Vary the number of inserts/deletions • At what point does JPF crash?

  8. Test Classes • Driver Class • Creates • N insertThreads • M deleteThreads • Insert Thread • Inserts a single number into the queue • Delete Thread • Loops until a single number removed from queue • Use of sleep important

  9. Code Modifications • Maximum Level = 3 • Probabilistic level selection replaced with a random level • Probabilistic function calls random multiple times • Too many additional paths for JPF • Removed back-off period

  10. A Note • At the end of the code • Print “End of Code” • Marks each time JPF reaches the end of a potential execution path • I consider each “End of Code” to correspond with a different thread interleaving (i.e. a path)

  11. Verification Results • (1,2) = 1 Insert Thread, 2 Delete Threads

  12. By Comparison • Implemented simple priority queue test • java.util.PriorityQueue • Not safe for concurrency • Synchronized insert statement using a lock on the queue • Able to test inserting 8 numbers quickly • 3713 Paths • Tested in 45 Min • Inserting 10 numbers • Crashed after 60791 Paths

  13. What is the Difference? • Using synchronized method • Very few points where a thread can take over • I.e. When one thread is inserting, none of the others can insert at the same time • Lock Free • Threads can be interrupted after every instruction • This results in many more potential interleavings

  14. Errors ! • java.lang.OutOfMemoryError: • GC overhead limit exceeded • More than 98% of time spent on GC • Recovering less than 2% of the heap • java.lang.OutOfMemoryError: • Java heap space • [SEVERE] JPF out of memory • [SEVERE] JPF exception, terminating: • class java.lang.NullPointerException: null

  15. Further Work • Reduce Max level to 2 • Further reducing number of paths • Enable back-off function • Find linearization points in the code • Add each number into two queues at the same time • Try some of the other search classes

  16. Conclusion • Testing at this point has not found errors • When inserting up to 2 numbers • When inserting 3 numbers (before crashing) • More work needed to reduce the chance of errors further • Will not eliminate completely

  17. Thank You Questions?

More Related