Implementing a Concurrent Set in Go – Part III

In the previous part of this series, we studied the Coarse-Grained Synchronization approach to run concurrent operations in our Set. We concluded that it’s a correct and reliable implementation, but it can suffer from contention when the concurrency levels are high. In this third part, we’ll review the¬†Fine-Grained Synchronization¬†approach. Unlike Coarse-Grained, in which we haveContinue reading “Implementing a Concurrent Set in Go – Part III”

Implementing a concurrent Set in Go – Part II

In the first part of this series, we reviewed the basic structure for a list-based Set. We defined three methods to interact with the Set: Add(), Remove() and Contains().  Even though this implementation works fine for one goroutine, it didn’t work correctly for concurrent threads modifying the list. Since the algorithm to traverse the linked list uses two pointers thatContinue reading “Implementing a concurrent Set in Go – Part II”