Visualizing concurrency

Our first attempt at visualizing concurrency will have two simple goroutines running the drawPoint function in a loop with 100 iterations. After running this, you can visit localhost:1900/visualize and see what concurrent goroutines look like.

If you run into problems with port 1900 (either with your firewall or through a port conflict), feel free to change the value on line 99 in the main() function. You may also need to access it through if your system doesn't resolve localhost.

Note that we're not using WaitGroup or anything to manage the end of the goroutines because all we want to see is a visual representation of our code running. You can also handle this with a specific blocking code or runtime.Gosched() ...

Get Mastering Concurrency in Go now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.