Verification #25 · 2026-10-18 · Fork in loops · Medium · about 15 min

Workers that all think they are the last one

pool in pool.sv runs a set of workers at the same time. run() starts one worker for each entry of latency:

  • worker k waits latency[k] rising edges of the clock, then appends k to done;
  • all workers run concurrently, so done ends up in the order they finish;
  • run() returns when every worker has finished, and not before. The caller may have threads of its own, started with fork ... join_none, that must keep running: run() must not wait for them.

done comes out as a list of the wrong ids, and run() comes back at once. Fix pool.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.