The present invention provides a method and an apparatus for scheduling a
flow on an output link among a plurality of flows of incoming packet
traffic at a network device associated with a data network. A scheduler
comprises scheduler logic that uses a credit counter per flow to keep
track of the service difference received between two or more flows and
selects the flow for service next that has the maximum credit value. The
scheduler logic updates an amount of credit value in a counter of the
next flow with the front-end packet currently being served among the
first and second flows with a value that substantially equals a packet
size value divided by a flow weight value of the front-end packet
currently being served. The scheduler logic further updates an amount of
credit value in the first and second counters of the first and second
flows having packets waiting with a value that substantially equals the
size of the front-end packet currently being served.