1 / 13

Lock-Free concurrent algorithm for Linked lists: Verification

Lock-Free concurrent algorithm for Linked lists: Verification. CSE-COSC6490A : Concurrent Object-Oriented Languages York University - W09. Speaker: Alexandre Walzberg Date: May, 14th 2009 Paper: MikhailFomitchev and Eric Ruppert, Lock-Free Linked Lists and Skip Lists. PODC'04 , 2004. Plan.

crwys
Download Presentation

Lock-Free concurrent algorithm for Linked lists: Verification

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. Lock-Free concurrent algorithm for Linked lists: Verification CSE-COSC6490A : Concurrent Object-Oriented LanguagesYork University - W09 Speaker: Alexandre Walzberg Date: May, 14th 2009 Paper: MikhailFomitchev and Eric Ruppert, Lock-Free Linked Lists and Skip Lists.PODC'04, 2004.

  2. Plan • The algorithm - reminder • Verification of the list content • Verification of the lock-free property

  3. 1. The Algorithm - reminder Reminder C A B • Back-link allow a thread to not start research from head if it encounter a “in deletion” node. • The mark logically delete the node and avoid1) deletion of C2) Insertion of B’ between B and C • A flag prevent any operation on the node (except the deletion of the next node) Mark Flag

  4. 1. The Algorithm - reminder AtomicStampedReference<T> • Own: • A reference to an object of class T • A Stamp (integer) • Getters and Setters for the reference and the stamp • Atomic CAS operation which change both the reference and the stamp atomically • Reading and writing on both the reference and the stamp are Volatile public boolean compareAndSet( V expectedReference, V newReference, int expectedStamp, int newStamp)

  5. 1. The Algorithm - reminder The class Node Node int value … 31 2 1 0 int key … 31 2 1 0 Node backlink … 31 2 1 0 AtomicStampedReference<T> next int Node … … 31 2 1 0 31 2 1 0

  6. 2. Verification of the list content Test done • Concurrent insertion/deletion of nodes1) with same key 2) with different key3) with both 4) With key in reverse order • Main problem testInsertion of all even keysInsertion of odd keys | Deletion of even keys • For each ThreadRandom delay between operation • Random operation (search / insert / delete) • Random key values

  7. 2. Verification of the list content Verification method • Insertion of random keys 0 < k < 10 000 • Array verif of 10 000 elements. • Exist and Checked are Atomic Booleans Insertion : set verif [ inserted key ].exist at trueDeletion : set verif [ inserted key ].exist at false Verification :1) Verify that all elements of the list are indeed record as existing and set checked as true.2) Verify that each element recorded has been checked.

  8. 2. Verification of the list content Verification method : limitation We can not make insertion and deletion at the same time hence actual deletion/insertion can not be atomically with recording in the array. Instead : Insertion | insertion | insertionRendez-Vous of all threadsDeletion | Deletion | Deletion For the main problem test : Insertion of all even keysInsertion of odd keys | Deletion of even keys We can just control at the end that all even keys are absent and all odd keys are present

  9. 3. Verification of thelock-free property Pre-emption Insertion of sleep( “random time”) into delete-group functions to forcepre-emption by the scheduler in the middle of a deletion (between each step) => Test of the lock-free property and distribution of the algorithm Distribution of the algorithm Comment of all lines calling the helper in other function than Deletion functions => performance decrease a lot In additions, stopping a thread in the middle of a deletion make live-locks in other threads.

  10. 3. Verification of thelock-free property Contention Live-lock indicator: Counting number of loop iteration in the algorithm using an Atomic Long (that we can Atomically increase). => Contention is negligible (less than 0.01 loop iteration / operation)

  11. 3. Verification of thelock-free property Live-Lock problem In assignment 2, I had a live-lock problem.I add a CAS operation to fix the problem. However this operation was normally not required and not part of the described algorithm. During verification, I found the problem, coming from a miss-use of the Compare And Set operation. Then I could delete this extra CAS operation.

  12. Conclusion • JPF • No error detected for short test program with a small amount of thread • Execution too long for a big amount of thread or long test • Could not find the use of JPF. Could not find any property to check using asserts (could not find easy to check invariant) • Verification of the list content • The verification system can handle concurrent insertion and concurrent deletion but not concurrent insertion and deletion. • Verification of the lock-free property • The lock-free property is respected. The algorithm distribute task amongst threads.

  13. Any questions ?? Thank you for your attention!

More Related