func main() {
ch1 := make(chan int, 3)
ch1<- 10
ch1<- 20
ch1<- 30
ch1<- 40
}
fatal error: all goroutines are asleep - deadlock!
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In general computing, a deadlock is a situation where two different programs or processes depend on one another for completion, either because both are using the same resources or because of erroneous cues or other problems.https://www.techopedia.com/definition/2766/deadlock-computers
There was a time where operating systems were only able to execute a single process at a time, thus giving full system resource and attention to that one single process. Nowadays operating systems can handle multiple tasks at once, but sometimes they have to deal with a problem known as a deadlock. A deadlock occurs when there is at least one process, who is waiting for resources to be released by another process, in order to finish a task correctly. https://study.com/academy/lesson/what-is-deadlock-definition-examples-avoidance.html
In general computing, a deadlock is a situation where two different programs or processes depend on one another for completion, either because both are using the same resources or because of erroneous cues or other problems.https://www.techopedia.com/definition/2766/deadlock-computers
There was a time where operating systems were only able to execute a single process at a time, thus giving full system resource and attention to that one single process. Nowadays operating systems can handle multiple tasks at once, but sometimes they have to deal with a problem known as a deadlock. A deadlock occurs when there is at least one process, who is waiting for resources to be released by another process, in order to finish a task correctly. https://study.com/academy/lesson/what-is-deadlock-definition-examples-avoidance.html
I know the general meaning of a deadlock, but I don't know the meaning of a deadlock in golang. For example, I send 4 values to a buffered channel whose maxmum size is 3 and a deadlock occurs. I think this is just "values are out of bounds" like array. What does a deaklock mean in golang?
-j
The error you're seeing isn't an "out of bounds" error, rather, on the
last send the channel is already full so the sending goroutine waits until
there is space to insert the new item. Since there is nothing that will
ever take stuff out of the channel, this is never going to happen --
therefore you have a deadlock.
Normally, the result of a deadlock is that things just hang,
I know the general meaning of a deadlock, but I don't know the meaning of a deadlock in golang.
For example, I send 4 values to a buffered channel whose maxmum size is 3 and a deadlock occurs.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.