What are channels in Go language and how can you use them?

devquora
devquora

Posted On: Feb 22, 2018

 

Go provides a mechanism, which is called channel that is utilized to share data between goroutines. When you execute a concurrent activity as a goroutine a resource or data is required to share between goroutines, channel acts as a pipe between the goroutines and gives them a mechanism that guarantees a synchronous exchange. There are two types of channels based on their actions:
  1. Unbuffered Channels: It is used to behave in a synchronous communication between goroutines.
  2. Buffered Channels: It is used to perform synchronous communication

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Go Programming Language

    What are Goroutines?

     Goroutines are the methods and functions that run concurrently with another methods or functions. Goroutines can be co..

    Go Programming Language

    How can you distribute tasks in Go to different machines?

    Following details is the way how we can distribute various tasks in Go to different machines: Get the Dependencies Writ..

    Go Programming Language

    What is a string literal in Go programming?

    Go supports two syntaxes for string literals. With regular quotes, special sequences like newlines are interpreted as a..