According to wikipedia concurrency can be defined like this:
The property of program, algorithm, or problem decomposability into order-independent or partially-ordered components or units. This means that even if the concurrent units of the program, algorithm, or problem are executed out-of-order or in partial order, the result will remain determinate.
A form of computing in which several computations are executing during overlapping time periods—concurrently—instead of sequentially (one completing before the next starts)
An example of a concurrent program could be a web server that can receive multiple requests “at the same time”. If the server wasn’t concurrent, users would have to wait for another request to be processed before the server could handle their request.
Go is said to make concurrency very easy to program so today I’m going to explore it.
To explain concurrency it’s useful to have parts of a program that can execute asynchronously or in parallel. As an example I’m going to use a pair of functions that pretend to get some information from a database or service. Lets look at a simple example where everything is executed without concurrency: