← All Exercises

Goroutine Worker Pool

intermediatego~25min

Background

Worker pools limit concurrency to prevent resource exhaustion when processing many tasks.

Problem

Create a pool of N goroutines that process tasks from a channel and return results on another channel.

Input

Number of workers and tasks

Output

Processed results from workers

Sample tests

Sample 1

Input: 3 workers, 10 tasks
Expected: 10 results

Your solution

Learning objective

Learn Go concurrency patterns and channel communication