Hi,
- I believe this is more of a multi-threading question rather than being zig specific, if it's the former please disregard
- I've recorded this demo to explain it better
- In the demo, you can see all threads are processing fixed amount of work (calculating pixel color) however some threads finish sooner and is there any way to redistribute the work?
- I tried to re-produce the scenario, here's the gist
- Output (basically there's delay for thread 2 and it's not clearly evident from o/p though, however delay can be seen in the demo)
$ zig run /tmp/main.zig
Thread: 0 working on range 1 to 3
crunching value for 1
crunching value for 2
crunching value for 3
Thread: 1 working on range 4 to 6
slow thread 1, crunching value for 4
Thread: 2 working on range 7 to 9
crunching value for 7
crunching value for 8
crunching value for 9
slow thread 1, crunching value for 5
slow thread 1, crunching value for 6
Thanks in advance.
