1 / 16

Checking nonblocking concurrent queue program

Checking nonblocking concurrent queue program. Jun Miao York University 9/12/2014. Concurrent Queue. Queue is a widely used ADT in computer science Insertions and deletions follow the first-in first-out scheme. Node Structure. Initialization. Node<E> dummy = new Node<E>(null,null);

carson
Download Presentation

Checking nonblocking concurrent queue program

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. Checking nonblocking concurrent queue program Jun Miao York University 9/12/2014

  2. Concurrent Queue • Queue is a widely used ADT in computer science • Insertions and deletions follow the first-in first-out scheme

  3. Node Structure

  4. Initialization • Node<E> dummy = new Node<E>(null,null); • this.head = new AtomicStampedReference<Node<E>>(dummy,0); • this.tail = new AtomicStampedReference<Node<E>>(dummy,0); head tail Stamp = 0 Reference Dummy Node <null, null> Stamp = 0 Reference

  5. Enqueue If NO CompareAndSet is used in 3 steps Swing Tail to the last node

  6. Dequeue Is current Head unchanged? Are Head and Tail pointing to the same node because Tail is not updated?

  7. Properties • no uncaught exceptions • no data races • All listeners can be found in javapathfinder-trunk\src\gov\nasa\jpf\tools

  8. NullPointerException • Problem: q.head points to a null node • The only possible reason: 1. q.head != q.tail 2. q.head.next == null But how does this happen?

  9. Struggling with NullPointerException • NonNullChecker is used • First Attempt • 2 threads

  10. Simple is good • Second Attempt • Start from 1 thread with 1 operation 2 threads: 2 enqueue , 2 dequeue, 1 enqueue and 1 dequeue 3 threads: 3 enqueue …. 4 threads: 4 enqueue… Result:

  11. PreciseRaceDetector • Two threads • Enqueue|Dequeue • Enqueue|Enqueue • Dequeue|Dequeue • Three threads… • Four thread… • Result:

  12. Exceptions and Data races • No Exceptions in the concurrent queue operations • No Data races • My question: is my testing enough?

  13. Something interesting • This algorithm came out of a discussion with Franck van Breugel and Sergey Kulikov from the University of York. All credits for it goes to Franck and Sergey, all the bugs are mine. • Author: Willem Visser

  14. Post Condition • Start from q.head • Print value of each node sequentially • Reach q.tail

  15. Conclusion • Testing the program step by step • The more enqueue operation, the more time consumed by JPF checking • Testing time increases significantly

  16. Question Time

More Related