$25
1. Write a program called “rr” that implements round robin queuing disciple. This function should take the service rate as the input argument. The file “arrivals.txt” contains the list of packets arrivals. Each packet arrival is denoted by a line in this file as “W X Y Z”, where W is the packet arrival time, X is the packet ID, Y is the queue ID into which the packet arrives, and Z is the packet length. You should be able invoke your program as follows:
./rr 4.0 < arrivals.txt
The output of the above invocation should be, for each packet, “U V” (without quotes), where
U is the transmission time of the packet (“%.2f” format), and V is the packet ID. [50]
2. Write a program called “wfq” that implements weighted-fair queuing disciple. This function should take, as arguments, the service rate and the weights for each of the queues. The file “arrivals.txt” contains the list of packets arrivals. Each packet arrival is denoted by a line in this file as “W X Y Z”, where W is the packet arrival time, X is the packet ID, Y is the queue ID into which the packet arrives, and Z is the packet length. You should be able invoke your program as follows:
./wfq 4.0 1.0 1.0 1.0 1.0 < arrivals.txt
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, and W is the id of the queue that output this packet.
End of paper