Starting from:
$35

$29

Lab 8 (FIFO queuing and Token bucket) Solution

    1. Write a program called \shape" that implements token bucket based tra c shaping. This function should have two input arguments. The rst argument is an integer and denotes the size of token bucket, whereas the second argument is the rate at which tokens are falling into the token bucket. The le \arrivals.txt" contains the list of packets arrivals. Each packet arrival is denoted by a line in this le as \X Y Z", where X is arrival time, Y is packet ID, and Z is packet length. You should be able invoke your program as follows:

./shape 250 4.0 < arrivals.txt

The above invocation should shape the tra c in the le \arrivals.txt" using a token bucket of capacity 250 and rate 4.0. The output of the above invocation should be, for each packet, \U V W" (without quotes), where U is the transmission time of the packet (\%.2f" format), V is the packet ID (\%d" format), and W is length of the packet (\%d" format). Your program will be evaluated for 6 test cases by running the script \./testShape", and 5 point will be

awarded for each test case passed.
[30]

    2. Write a program called \ fo" that implements a nite capacity FIFO queue. This function should have two input arguments. The rst argument is an integer and denotes the bu er size (including the packet being served / HOL packet), whereas the second argument is the constant rate at which data is pushed to the output line of the queue. The HOL packet is held in bu er until it is completely transmitted. The le \arrivals.txt" contains the list of packets arrivals. Each packet arrival is denoted by a line in this le as \X Y Z", where X is arrival time, Y is packet ID, and Z is packet length. You should be able invoke your program as follows:


./fifo 250 4.0 < arrivals.txt

The above invocation should simulate the tra c in the le \arrivals.txt" passing through a FIFO queue of capacity 250 and output rate 4.0. The output of the above invocation should be, for each packet, \U V W" (without quotes), where U is the transmission completion time

of the packet (\%.2f" format), V is the packet ID (\%d" format), and W is length of the

packet (\%d" format). Your program will be evaluated for 6 test cases by running the script

\./testFifo", and 5 point will be awarded for each test case passed.
[30]
3. The tra  c in  le \arrivals.txt" is  rst passed though a token bucket of capacity 500 and rate

x, and then passed through a FIFO queue of capacity 1000 and rate 10:0. Find the largest x

(upto 6 decimal places) which ensures that no packets are dropped by the FIFO queue?
[40]









End of paper

More products