Download presentation
Presentation is loading. Please wait.
1
Computer Laboratory Practical non-blocking linked lists Tim Harris tim.harris@cl.cam.ac.uk Computer Laboratory
2
Overview: lists using CAS Insert 20: H10 30 T 20 30 20 10 30 20 30 20
3
Computer Laboratory Overview: lists using CAS Insert 20: H10 30 T 20 30 20 25 30 25 10 30 20 30 20 25 30 25
4
Computer Laboratory Overview: lists using CAS Delete 10: H10 30 T 10 30 H10 30 10 30
5
Computer Laboratory Overview: lists using CAS Delete 10 & insert 20: H10 30 T 10 30 H10 30 10 30 20 30 20 H10 30 10 30 H10 30 10 30 20 30 20
6
Computer Laboratory What can you do? Stronger primitives, e.g. DCAS H10 10 3030 XX H10 10 3030 XX 30 T
7
Computer Laboratory What can you do? Extra indirection: H10 30 T 30 1010 b 10d b 30 30 10 10d b c a H10 10 b a
8
Computer Laboratory Logical vs physical deletion Use a ‘spare’ bit to indicate logically deleted nodes: H10 30 T 20 10 30 30 30X 30 20 H10 30 20 10 30 30 30X 30 20
9
Computer Laboratory H Storage management Must control memory re-use while threads hold pointers to it H10 30 T10 30
10
Computer Laboratory Storage management (2) Time A B C Ref counting, tracing GC, time-based re-use Add object to A’s deferred free list A finishes. C not complete: can’t free object yet Add object to C’s deferred free list C finishes A can now re-use the object it removed: B&C can’t have pointers to it Delayed threads can prevent any re-use
11
Computer Laboratory Storage management (3) Also need to consider visibility of updates H10 30 T 20 30 20 Write-write 10 30 20 30 20 Write-write
12
Computer Laboratory Storage management (4) …and re-ordering of dependent reads H10 30 T 20 10 30 while (val < seek) { p = p->next; val = p->val; } val = ???
13
Computer Laboratory Random insert/delete Per-thread CPU-time / s Valois (ref-counted) New (ref-counted) Valois Number of threads Valois, ref-counting New, ref-counting Valois New Mutex
14
Computer Laboratory Random insert/delete (2) Per-thread CPU-time / s Valois (ref-counted) New (ref-counted) Valois Number of threads Valois, ref-counting New, ref-counting Valois New Mutex Valois New
15
Computer Laboratory Successful insertions Occurances Duration / cycles Mutex New Valois
16
Computer Laboratory Unsuccessful insertions Duration / cycles Mutex New Mutex Valois Occurances
17
Computer Laboratory Delete greater-than H10 30 T DeleteGE 20 10 30 20 Insert 20 30 T T TX Insert 30 30?
18
Computer Laboratory Delete greater-than (2) H10 30 T Insert 20: 3020 T 20X 30 T 20 T 20X
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.