Two heaps for a pool of servers
transcript
Many servers. Jobs arrive. Give each to the lightest free one. Two heaps do it.
Free servers go by weight. Busy servers go by finish time. Release finished servers first. Then the lightest free one takes the job.
Job zero takes server one until time four. Job one takes server two until time two. At time two, server two is done. It is free for job two.
A server that finishes at time t is free at time t. Release with at most, not below. Below gives the wrong servers. Test it on a small case.
Every server is busy. The job waits. Jump the clock to the first finish. Then assign as usual.
Each job pops one free server. It pushes one busy server. Each step costs log s. Seven million steps, not ten billion.
One heap for free servers. One heap for busy servers. Try it in the lab. Full breakdown in the lecture.