Skip to main content

4 posts tagged with "concurrency"

View All Tags

Concurrent streaming in Go with channels

· 6 min read
Yaroslav Grebnov
Golang developer, SDET

The previous exercises map a finite slice with sync.WaitGroup or errgroup. This version processes values as they arrive. The input size does not need to be known, and successful results can be consumed before the input channel closes.

Stream accepts a receive-only input channel and returns separate receive-only result and error channels. A fixed worker pool bounds concurrency.

Parallel map in Go with sync.WaitGroup

· 5 min read
Yaroslav Grebnov
Golang developer, SDET

This interview exercise starts with a concurrent map and adds the invariants interviewers commonly ask about: stable order, identifiable results, bounded concurrency, cancellation, and panic recovery.

The final implementation returns one result for every input. A failed or panicking task does not hide the results of other tasks.