Previous | Next --- Slide 5 of 37
Back to Lecture Thumbnails
cwchang

When two threads are going to insert their values to the same position (between two same nodes), the n->next=cur and prev->next=n assignment might go wrong.

lfragago

The concurrency problem here is that both functions are not atomic. Specifically:

For insert: undesired behavior occurs when two threads are trying to insert in-between the same two nodes. In such case, a node (one of the two nodes that any of the threads wanted to insert) would be lost.

For delete: It is possible that one thread is deleting a node, that another thread is trying to insert "in-between". Which leads to undesired behavior (possibly a segfault if the previous node to where we are inserted is deleted)

pajamajama

Simultaneous deletes may occur where both threads go to the node they are looking to delete, see that it's present and then attempt to delete/free that node. A segmentation fault occurs since one will be trying to delete a node that isn't there anymore.

srb

Any combination of simultaneous insertions and deletions into the same part of the list could cause a major issue by trying to point to nodes that aren't there, referencing nodes that have been deallocated, or losing a list update entirely.