In a first aspect, a network processor includes a scheduler in which a
scheduling queue is maintained. A last frame is dispatched from a flow
queue maintained in the network processor, thereby emptying the flow
queue. Data indicative of the size of the dispatched last frame is stored
in association with the scheduler. A new frame corresponding to the
emptied flow queue is received, and the flow corresponding to the emptied
flow queue is attached to the scheduling queue. The flow is attached to
the scheduling queue at a distance D from a current pointer for the
scheduling queue. The distance D is determined based at least in part on
the stored data indicative of the size of the dispatched last frame.