Multicore Programming Skip list Tutorial 10 CS 0368-3469 Spring 2010.

Slides:



Advertisements
Similar presentations
EcoTherm Plus WGB-K 20 E 4,5 – 20 kW.
Advertisements

1 A B C
Simplifications of Context-Free Grammars
Variations of the Turing Machine
AP STUDY SESSION 2.
1
Slide 1Fig 25-CO, p.762. Slide 2Fig 25-1, p.765 Slide 3Fig 25-2, p.765.
Select from the most commonly used minutes below.
Multiprocessor Architecture Basics
David Burdett May 11, 2004 Package Binding for WS CDL.
Local Customization Chapter 2. Local Customization 2-2 Objectives Customization Considerations Types of Data Elements Location for Locally Defined Data.
Create an Application Title 1Y - Youth Chapter 5.
Add Governors Discretionary (1G) Grants Chapter 6.
CALENDAR.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt BlendsDigraphsShort.
CHAPTER 18 The Ankle and Lower Leg
The 5S numbers game..
Media-Monitoring Final Report April - May 2010 News.
Break Time Remaining 10:00.
Factoring Quadratics — ax² + bx + c Topic
EE, NCKU Tien-Hao Chang (Darby Chang)
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
Ordered linked list implementation of a set
1 Linked Lists A linked list is a sequence in which there is a defined order as with any sequence but unlike array and Vector there is no property of.
Briana B. Morrison Adapted from William Collins
Bellwork Do the following problem on a ½ sheet of paper and turn in.
Regression with Panel Data
K ONTRAK PERKULIAHAN I Made Gatot K, ST. MT 1. PENILAIAN Kehadiran min 75 % : 5 % Tugas: 20 % Diskusi / Presentasi: 20 % UTS: 25 % UAS: 30 % TOTAL: 100%
1 The Royal Doulton Company The Royal Doulton Company is an English company producing tableware and collectables, dating to Operating originally.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Biology 2 Plant Kingdom Identification Test Review.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
1 Termination and shape-shifting heaps Byron Cook Microsoft Research, Cambridge Joint work with Josh Berdine, Dino Distefano, and.
Artificial Intelligence
Before Between After.
Slide R - 1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Prentice Hall Active Learning Lecture Slides For use with Classroom Response.
12 October, 2014 St Joseph's College ADVANCED HIGHER REVISION 1 ADVANCED HIGHER MATHS REVISION AND FORMULAE UNIT 2.
Subtraction: Adding UP
: 3 00.
5 minutes.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Speak Up for Safety Dr. Susan Strauss Harassment & Bullying Consultant November 9, 2012.
Static Equilibrium; Elasticity and Fracture
Essential Cell Biology
Converting a Fraction to %
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Clock will move after 1 minute
famous photographer Ara Guler famous photographer ARA GULER.
PSSA Preparation.
& dding ubtracting ractions.
Copyright © 2013 Pearson Education, Inc. All rights reserved Chapter 11 Simple Linear Regression.
Physics for Scientists & Engineers, 3rd Edition
Select a time to count down from the clock above
Copyright Tim Morris/St Stephen's School
1.step PMIT start + initial project data input Concept Concept.
1 Dr. Scott Schaefer Least Squares Curves, Rational Representations, Splines and Continuity.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
Presentation transcript:

Multicore Programming Skip list Tutorial 10 CS Spring 2010

2 Set Object Interface Collection of elements No duplicates Methods –add() a new element –remove() an element –contains() if element is present

3 Many are Cold but Few are Frozen Typically high % of contains() calls Many fewer add() calls And even fewer remove() calls –90% contains() –9% add() –1% remove() Folklore? –Yes but probably mostly true

4 Concurrent Sets Balanced Trees? –Red-Black trees, AVL trees, … Problem: no one does this well … … because rebalancing after add() or remove() is a global operation

5 Skip Lists Probabilistic Data Structure No global rebalancing Logarithmic-time search

6 Skip List Property Each layer is sublist of lower-levels

7 Skip List Property Each layer is sublist of lower-levels

8 Skip List Property Each layer is sublist of lower-levels

9 Skip List Property Each layer is sublist of lower-levels

10 Skip List Property Each layer is sublist of lower-levels Lowest level is entire list

11 Skip List Property Each layer is sublist of lower-levels Not easy to preserve in concurrent implementations …

12 Search contains(8) Too far

13 Search contains(8) OK

14 Search contains(8) Too far

15 Search contains(8) Too far

16 Search contains(8) Yes!

Search contains(8)

Logarithmic contains(8) Log N

19 Why Logarthimic Property: Each pointer at layer i jumps over roughly 2 i nodes Pick node heights randomly so property guaranteed probabilistically 2i2i 2i2i

20 Find() -- Sequential int find(T x, Node [] preds, Node [] succs) { … }

21 Find() -- Sequential int find(T x, Node [] preds, Node [] succs) { … } object height (-1 if not there)

22 Find() -- Sequential int find(T x, Node [] preds, Node [] succs) { … } Object sought object height (-1 if not there)

23 Find() -- Sequential int find(T x, Node [] preds, Node [] succs) { … } object sought return predecessors Object height (-1 if not there)

24 Find() -- Sequential int find(T x, Node [] preds, Node [] succs) { … } object sought return predecessors return successors object height (-1 if not there)

25 Successful Search find(7, …) prev

26 Successful Search find(7, …) curr prev

27 Unsuccessful Search find(6, …) prev

28 Unsuccessful Search find(6, …) curr prev

29 Lazy Skip List Mix blocking and non-blocking techniques: –Use optimistic-lazy locking for add() and remove() –Wait-free contains() Remember: typically lots of contains() calls but few add() and remove()

30 Review: Lazy List Remove aa b c d

31 Review: Lazy List Remove aa b c d Present in list

32 Review: Lazy List Remove aa b c d Logically deleted

33 Review: Lazy List Remove aa b c d Physically deleted

34 Lazy Skip Lists Use a mark bit for logical deletion

35 add(6) Create node of (random) height

36 add(6) find() predecessors

37 add(6) find() predecessors Lock them

38 add(6) find() predecessors Lock them Validate Optimistic approach

39 add(6) find() predecessors Lock them Validate Splice

40 add(6) find() predecessors Lock them Validate Splice Unlock

41 remove(6)

42 remove(6) find() predecessors

43 remove(6) find() predecessors Lock victim

remove(6) find() predecessors Lock victim Set mark (if not already set) Logical remove…

remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate

46 remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate Physically remove

47 remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate Physically remove

48 remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate Physically remove

49 remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate Physically remove

50 remove(6) find() predecessors Lock victim Set mark (if not already set) Lock predecessors (ascending order) & validate Physically remove

51 contains(8) Find() & not marked

52 contains(8) Node 6 removed while traversed

53 contains(8) Node removed while being traversed

54 contains(8) Prove: an unmarked node (like 8) remains reachable

remove(6): Linearization Successful remove happens when bit is set Logical remove…

56 Add: Linearization Successful add() at point when fully linked Add fullyLinked bit to indicate this Bit tested by contains()

57 contains(7): Linearization When fully-linked unmarked node found Pause while fullyLinked bit unset

58 contains(7): Linearization When do we linearize unsuccessful Search? 1 So far OK…

59 contains(7): Linearization When do we linearize unsuccessful Search? 7 7 But what if a new 7 added concurrently?

60 contains(7): Linearization When do we linearize unsuccessful Search? Prove: at some point 7 was not in the skip list

61 A Simple Experiment Each thread runs 1 million iterations, each either: –add() –remove() –contains() Item and method chosen in random from some distribution

62 Lazy Skip List: Performance Multiprogramming search Throughput

63 Lazy Skip List: Performance Multiprogramming Higher contention search Throughput

64 Lazy Skip List: Performance Multiprogramming Unrealistic Contention search Throughput

65 Summary Lazy Skip List –Optimistic fine-grained Locking Performs as well as the lock-free solution in common cases Simple

66 This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.Creative Commons Attribution-ShareAlike 2.5 License You are free: –to Share to copy, distribute and transmit the work –to Remix to adapt the work Under the following conditions: –Attribution. You must attribute the work to The Art of Multiprocessor Programming (but not in any way that suggests that the authors endorse you or your use of the work). –Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to – Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights.