 Welcome to the another session of Conjection Control. In this session I will explain the another important algorithm of Conjection Control that is Token Bucket Algorithm. Learning outcome at the end of this session student will be able to describe the token bucket algorithm and they will compare leaky bucket and token bucket algorithms. So, first of all let us see why token bucket algorithm is needed. The leaky bucket algorithm enforces a rigid output pattern at the average rate and no matters how the bursty the traffic is. For many application it is better to allow the output to speed up the somewhat when the large burst is arrived. So, a more flexible algorithm is needed preferably one that never loses the data. One such algorithm is token bucket algorithm. In this algorithm the leaky bucket holds the token generated by the clock at the rate of one token every delta t second. Now look at in the figure one the bucket holding the three tokens with the five packets waiting to be transmitted. Now in this the five packets are waiting to for the transmission. For a packet to be transmitted it must captured and destroy one token. Now look at the another diagram. So in this another figure B three of the five packets have gotten through but the other two are stuck here these two are stuck here and waiting for the two more token to be generated. So the simple idea for the token but bucket algorithm is what here the interface includes or it contains the leaky bucket and this leaky bucket contains the token. Now the token bucket algorithm provides a different kind of traffic shaping than that of the leaky bucket algorithm. The leaky bucket algorithm does not allow idle host to save up the permission to send the large burst later. The token bucket algorithm allows saving up to the maximum size of the bucket. The property means this property means that the burst of up to the end packet can be sent at once allowing some burstiness in the output stream and giving the faster response to sudden burst of the input. The token bucket algorithm does not discard the packet. The leaky bucket and the token bucket algorithm can be used to smooth the traffic between the routers. The token bucket regulating a host can make the host stop sending when the rule say it must stop telling a router to stop sending while its input keeps pouring in keeps pouring in or may result in the loss data. The implementation of the basic token bucket algorithm is just a variable and that counts the token. The counter is incremented by 1 every delta t and decremented by 1 whenever the packet is sent. When the counter hits 0, no packets may be sent. In the byte count variant, the counter is incremented by k bytes every delta t and decremented by the length of each packet sent. Now a potential problem with the token bucket algorithm is that it allows the large burst again even though the maximum burst interval can be regulated by the careful selection of the P and M. It is frequently desirable to reduce the peak rate, but without going back to the low value of the original leaky bucket. One way to get the smoother traffic is to insert a leaky bucket after the token bucket. So here in this token bucket algorithm both algorithms are used. The rate of the leaky bucket should be higher than the token bucket, but lower than the maximum rate of the network. So here the leaky bucket is used in the token bucket algorithm, okay. So now here pause the video and write down the answer. Compare leaky bucket algorithm with the token bucket algorithm. Now here is the comparison. Now in leaky bucket algorithm when the host has to send a packet, packet is thrown in the bucket. But in token bucket, in this leaky bucket holds the token generated at regular interval of time. In leaky bucket, the bucket leaks at constant rate whereas in token bucket, bucket has a maximum capacity to hold the tokens. Now in leaky bucket algorithm, bus-t traffic is converted into uniform traffic by leaky bucket. Now in token bucket, if there is a ready packet, a token is removed from the bucket and packet is sent. In leaky bucket algorithm or we can say that in practice the bucket is a finite queue output at the finite rate. But in token bucket, if there is a no token in bucket, the packets cannot be sent. That means what the packets are hold by the token and these are not lost at all. Let us say the advantages of token bucket over the leaky bucket. If the bucket is full in the token bucket, the tokens are discard not the packets, okay. So here the data is not lost. While in leaky bucket, the packets are discarded. The token bucket can send the large burst at a faster rate while the leaky bucket always send the packets at the constant rate. Now let us see another most important topic that is flow specification. The traffic shaping is most effective when the sender, receiver and subnet all agree to it. To give the agreement, it is necessary to specify the traffic pattern in a precise way. So the flow specification is an agreement consist of data structure that describe both the pattern of the injected traffic and the quality of the service desired by the application. A flow specification apply either to the packet sent on virtual circuit or to a sequence of datagram sent between the source and the destination. Now the example of flow specification, before a connection is established or before the sequence of the datagram are sent, the source gives the flow specification to the subnet for approval. The subnet can either accept it or reject it. Once the subnet accept this agreement, the maximum packet size tells how big the packet may be. For example, if the part of the path goes over an Ethernet, the maximum packet size will be restricted to no more than 1500 bytes, no matter what the rest of the network can handle. Similarly in token bus, the size of the packet is 8182 bytes. Now the token bucket rate is the number of bytes per second that are put into the bucket. Token bucket size tells how big the bucket is. For example, the token bucket rate is 1 Mbps and the token bucket size is 500 kb. The bucket can fill continuously for 4 seconds before it fills up. Any token sent after that are lost. Now the maximum transmission rate is the top rate that host is capable of producing under any condition. So these are the examples of flow specification. So in this video we have seen what actually a token bucket is. So to give a better performance or to provide a better conjection control, token bucket algorithm uses the leaky bucket. So here in this algorithm leaky bucket is also used and which holds the token and this token consists of the packet and because of this holding capability the packets are not lost. Then we have seen the another important topic that is flow specification. So this flow specification is what? It is the agreement in between the source, destination or the subnet and it can transmit the data with that particular capacity or the LAN capacity. So just now I told you the LAN capacity of the Ethernet is what? 81500 bytes whereas the token ring is what 8182 bytes or we can say that the 8182 bytes. So this is flow specification. These are the references, thank you.