Search⌘ K
AI Features

Solution 5: Go Concurrency

Explore how to apply Go's concurrency model by modifying worker routines to execute command-line tools concurrently. Learn to use goroutines, channels, and the os/exec package to run the wc tool for counting lines, words, and characters in text input within a concurrent system.

We'll cover the following...

Solution

To modify wPools.go so that each worker implements the functionality of wc(1), we can replace the calculation of the square with a call to the wc command-line tool using Go’s built-in os/exec package. ...