interface, go-routine, channels race condition deadlock in golang
Anonymous
An interface type is defined as a set of method signatures. A value of interface type can hold any value that implements those methods. A go-routine is a lightweight thread managed by the Go runtime. Channels are a typed conduit through which you can send and receive values with the channel operator, <-. Unbuffered channel is a channel that initially has no capacity to store message inside it. Unbuffered channel requires us to fill the message in order to make the goroutine process unblocked by the channel. Buffered Channel has a capacity to store messages inside it. Buffered Channel could be filled up to its defined capacity, not only one message. An array has a fixed size. A slice, on the other hand, is a dynamically-sized, flexible view into the elements of an array. In practice, slices are much more common than arrays. Race condition in Go occurs when two or more goroutines have shared data and interact with it simultaneously. This is best explained with the help of an example. Suppose two functions that increment an integer by 1 are launched in two separate goroutines and act on the same variable. Too fix that race condition with the help of Mutexes. In Golang, when two processes known as goroutines run concurrently and block each other's pathways, it's known as a deadlock.
Check out your Company Bowl for anonymous work chats.