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 127.0.0.1 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 Go: Building Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.