Patent ID: 7636307

Claim:
A method of controlling a queue of a communications system, comprising: detecting a color of a packet arriving at the queue, each color corresponding to a different drop precedence level; deciding an accept/discard operation on a packet arriving at the queue, based on comparison between a discard probability sum for packets having the detected color and a random variable; calculating a discard probability for the packet, using an average depth of the queue; generating a new discard probability sum for a next packet arriving at the queue, by summing the discard probability sum and the calculated discard probability; accepting a packet arriving at the queue when a discard probability sum for the packet is smaller than or equal to the random variable; discarding the packet arriving at the queue when the discard probability sum for the packet is larger than the random variable; setting the discard probability sum to zero; generating another random variable to replace the aforementioned random variable; measuring a current queue depth, N cur ; retaining a previous average queue depth, Previous N avg ; monitoring whether the queue is empty; and updating an average queue depth, New N avg by using these formulae: when the queue is not empty, New N avg =Previous N avg +W×(N cur −Previous N avg ), when the queue is empty and New N avg ≠Previous N avg , New N avg =Previous N avg ×function (idle time, W), and when the queue is empty and New N avg=Previous N avg , New N avg =Previous N avg +W×N cur −Previous N avg ), where W is a running weight.