Previous | Next --- Slide 37 of 66
Back to Lecture Thumbnails
gomi

We should pay special attention to the unlock right before the return in the delete function. Without it, we will end up in a deadlock situation.

nassosterz

Whenever using locks, a key aspect is to keep the critical section (code between calls to lock and unlock) as small as possible, to avoid serializing the calls. In the solution presented above, the critical section is almost the entire function call, which takes away any gains from parallelizing insertions and deletions over many threads.

Please log in to leave a comment.