DEV Community

Discussion on: Implement a timing wheel for millions of concurrent tasks.

Collapse
 
marcello_h profile image
Marcelloh

why not work with a pool of go-routines (and perhaps a queue to manage them)?

Collapse
 
kevwan profile image
Kevin Wan

It’s customizable by using different execute functions.

Collapse
 
marcello_h profile image
Marcelloh

I think the idea is nice but a controller, queue and pool will do the trick too, and is perhaps more maintainable.

Thread Thread
 
kevwan profile image
Kevin Wan

The tasks are delay time dependent. Would like to know how to handle it with queue?

Thread Thread
 
marcello_h profile image
Marcelloh

Some queues have timing inside, but you can make your own queue which has that. (or even multiple ones, for the various tasks)

Thread Thread
 
carl_eckhardt_7d76db670e0 profile image
Carl Eckhardt

Yeah. I was looking at doing this too. Your idea makes or allows the multiple time aligned tasks in each queue to operate independently. Kevin’s method is similar to derived clocks in an ASIC or FPGA. Each band of the circle uses the smallest resolution of the innermost timer step and uses that in multiples.