You are writing code to copy software over the network. Given a file size and a
ID: 3845120 • Letter: Y
Question
You are writing code to copy software over the network. Given a file size and a constant packet/buffer size, you can easily calculate the number of successful packet deliveries required to copy the file. What you cannot know beforehand is the time it takes to copy these packets. But users love to see a progress bar which estimates a duration left for copying the file.
a) Suppose you have a file that needs 10 same-size packets to be delivered and the first 9 packets have taken 123, 142, 130, 125, 132, 150, 140, 133, and 148 miliseconds respectively. Estimate the time it takes to deliver the last packet.
b) Now suppose you have a file that needs 1.000 same-size packers to be delivered and you have just delivered the first 499 packets. The average time for the 499 packets is 148 miliseconds, and the last 5 packets have taken 124,140, 132, 134, and 140 miliseconds respectively. Estimate the time it takes to deliver all packets.
Explanation / Answer
a) the avergae time till now for delivering one packet can be found by summing the delivery times of all 9 packets and then dividing by 9.. it will come to 136 msecs approx. Hence the last packet may take around 136 milli seconds.
b) We know the average for the first 499 packets and it is 148 seconds. This average includes the sum of the given 5 packets also, hence we can safely ignore those times, as they have already been considered in this average. So while total packets were 1000, and 499 have already been delivered, we are left with 501 packets, hence total remaining time to deliver all the packets will be 501 * 148 milli seconds, somewhere around 74 seconds.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.