A slow push in a fast run
transcript
A buffer doubles when it is full. Think of an alert buffer in a monitoring system. One push copies every item across. So is a push slow or fast? Count the whole run to find out.
A million pushes into a doubling buffer. The slowest push copied over half a million items. That is a real stall. But it happens only once.
Add up every copy over the whole run. One million forty eight thousand five hundred seventy five. That is fewer than two copies for each push. Add the write, and the work is about two for each push. Most pushes cost one step, and a few cost far more.
One push can be slow. The whole run is fast on average. Both statements are true. A hard deadline needs the worst case of one push.
Add the cost of the whole run. Divide by the number of pushes. It holds for every sequence of pushes.
Count the run, not one push. Full breakdown in the lecture.