maybe the best practice for worker pool scheduler, need review my code

141 views
Skip to first unread message

junior zhang

unread,
Feb 18, 2023, 11:43:57 AM2/18/23
to golang-nuts

Go Playground - The Go Programming Language

Hello everyone, this is a scheduling program similar to a WorkerPool that I implemented in Golang. The purpose of this program is to limit the number of goroutines while still allowing concurrent execution of my tasks. As a beginner in Golang, I may have overlooked some bugs in my code despite the fact that the main method runs and executes perfectly. There may be hidden bugs, such as goroutine leaks, deadlock bugs, or improper use of channels. I would appreciate it if you could help me review the code. Thank you.


Henry

unread,
Feb 22, 2023, 1:16:13 AM2/22/23
to golang-nuts
Go's goroutine is a thread pool. It maps M tasks over N threads. It has its own scheduler, etc. It reuses threads and avoids the overhead of unnecessary thread creation. I don't understand why you need to create a pool on top of another pool.
Reply all
Reply to author
Forward
0 new messages