#Mutex

4 articles

Knowing Deadlock and How to Overcome It in Golang

Knowing Deadlock and How to Overcome It in Golang

Introduction

One of the problems that occurs when using concurrent or parallel is the deadlock system. What is deadlock? Deadlock is an event where a concurrent process or goroutine waits for each other (lock) so that none of the goroutines can run. So be careful if you create an application or program that implements mutex lock and unlock using goroutines. Well we will try directly how to simulate the golang program when there is a deadlock.

How to Create RW Mutex and Its Use in Golang

How to Create RW Mutex and Its Use in Golang

Introduction to Sync.RWMutex

After we have learned Introduction and Creation of `Mutex` in the previous post, then we will continue to the next stage which is the introduction of RWMutex. Now what is the difference with the previous one?

How to Create Mutex and Its Use in Golang

How to Create Mutex and Its Use in Golang

Introduction of Sync.Mutex

Mutex or stands for Mutual Exclusion is a way to overcome race conditions in the Golang language. Mutex can be used to do locking and unlocking of a mutex so that if it is locked it will not be able to do locking again until we do unlocking.

How to Implement Golang's Singleton Design Pattern

How to Implement Golang's Singleton Design Pattern

Basic Definition

Singleton is a software design standard. This standard guarantees the existence of only one instance of a class, while maintaining a global point of access to its objects.