One of the best Go features is how easy we can use concurrency. The language gives us goroutines
, which are like lightweight threads managed by the Go runtime. It help us to run several functions at the same instant and is very helpful if you wish to improve the performance of your application.
Using this feature is easy as adding the go
keyword before any function call. This will make the function run concurrently. To make it simpler, let’s show you the code. Here I’ve written the SleepSort
algorithm, which uses the sleep
method to sort each element in its place.