Note: This is a meaningless slide to see in it's final build form. An animation was shown in class.
The hand-over-hand locking procedure:
Starts with 3 and 5 locked.
Releases 3, takes 10
Releases 5 takes 11
Now with 10 and 11 locked, the deletion of 11 can occur.
This comment was marked helpful 0 times.
jon
Hand-over-hand locking means that we can't unlock(node) until we lock(node->next). To see why this is needed, suppose we unlock(5) prior to lock(10). There is now a point at which 5 and 10 are both free, which enables someone else to successfully delete(10), before we are able to traverse the list and delete 11.
Note: This is a meaningless slide to see in it's final build form. An animation was shown in class.
The hand-over-hand locking procedure:
This comment was marked helpful 0 times.
Hand-over-hand locking means that we can't unlock(node) until we lock(node->next). To see why this is needed, suppose we unlock(5) prior to lock(10). There is now a point at which 5 and 10 are both free, which enables someone else to successfully delete(10), before we are able to traverse the list and delete 11.
This comment was marked helpful 0 times.