MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm...

13
University of Toronto Department of Electrical and Computer Engineering ECE361- Computer Networks Midterm Test October 27, 2015 Instructor: S. Valaee Last Name: _____________________Solution_____________________________ First Name: __________________________________________________________ Student Number: _______________________________________________________ Signature: ___________________________________________________________ Instructions This is a type A examination. Hence, it is a closed book exam and you are not allowed to use aid-sheets, textbooks or any other materials. You may use only non-programmable calculator. Clearly identify your final answer to each question (if there is more than one part that can be considered as your final answer, you will get no mark) Duration: 110 minutes Answer ALL questions on this test paper. EXAMINER's REPORT 1 /20 2 /20 3 /20 4 /20 5 /20 Total /100 Good luck

Transcript of MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm...

Page 1: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

University of Toronto Department of Electrical and Computer Engineering

ECE361- Computer Networks Midterm Test

October 27, 2015 Instructor: S. Valaee

Last Name: _____________________Solution_____________________________

First Name: __________________________________________________________

Student Number: _______________________________________________________

Signature: ___________________________________________________________

Instructions • This is a type A examination. Hence, it is a closed book exam and you are not allowed to

use aid-sheets, textbooks or any other materials. • You may use only non-programmable calculator. • Clearly identify your final answer to each question (if there is more than one part that can

be considered as your final answer, you will get no mark)

Duration: 110 minutes Answer ALL questions on this test paper.

EXAMINER's REPORT 1 /20

2 /20

3 /20

4 /20

5 /20

Total /100

Good luck

Page 2: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 2 of 13

(Q1) (20 points) (no partial mark) In the following questions, find the best answer and enter in the corresponding space.

1. Which one of the following items is correct?

a. The average transmission rate of TCP is approximately 3W/(4 RTT) where W is the maximum congestion window size.

b. UDP demultiplexes the arriving traffic at the receiver side but does not multiplex the traffic at the transmitter side.

c. UDP uses (mod 216) arithmetic for checksum calculations. d. UDP can never detect any error in a received packet.

2. Which one of the following items is correct?

a. Knowing the IP address of a local DNS server is optional and does not interfere with connecting to the internet

b. Increasing the link capacity decreases the transmission delay. c. UDP is a fair algorithm since it does not use congestion control. d. The transmission delay approaches infinity when the input traffic rate gets very

close to the link capacity.

3. Consider the following two cases: I. P2P can help content providers with small uplink bandwidth to distribute

their content easily. II. When two nodes become peers in Bit Torrent, they will stay peers until both

nodes receive all the chunks of the same file.

a. Both items are correct. b. Item I is correct, but item II in incorrect. c. Item II is correct, but item I in incorrect. d. Both items are incorrect.

4. Consider the following two cases: I. A mail client uses SMTP to read emails from the email server. II. Each DNS reply can only bring the answer to one query.

a. Both items are correct. b. Item I is correct, but item II in incorrect. c. Item II is correct, but item I in incorrect. d. Both items are incorrect.

a

b

b

d

Page 3: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 3 of 13

5. To resolve the IP address of a server, the root, TLD, and authoritative server should all

be visited. Assume that one-way propagation delay between the computer and the local DNS server is 10 msec and one-way propagation delay in the internet is 100 msec. How long does it take to resolve the IP address of the server

a. 620 msec b. 650 msec c. 680 msec d. none of the above

6. Which one of the following statements is incorrect?

a. HTTP maybe used to read emails from a server. b. HTTP is not a secure protocol. c. HTTP is a push and SMTP is a pull protocol. d. In both HTTP and SMTP, the header ends with a blank line.

7. Consider the following two cases: I. Two computers send a DNS query to resolve the IP address of

“yahoo.com” . They may resolve two different IP addresses. II. The content distribution time increases linearly with the number of nodes in a

client-server scheme and logarithmically in P2P file sharing.

a. Both items are correct. b. Item I is correct, but item II in incorrect. c. Item II is correct, but item I in incorrect. d. Both items are incorrect.

8. Which one of the following statements is correct?

a. Cookies are not used unless when the HTTP runs on UDP to make sure that a state for the connection is maintained.

b. For Cookies to be effective a local cookie file should be maintained by the browser.

c. Cookies can only be used when the programmer is hungry. d. The web server checks the content of the Cookie and will not reply to the

client HTTP protocol if the same website was already downloaded by the client.

a

c

a

b

Page 4: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 4 of 13

9. In the following figure, what will be the value of the question mark, if Selective-Repeat with is used? Let m = 4. Assume that ACKs are cumulative.

a. 3 b. 0 c. 4 d. 1

10. Consider the following distributed hash table. Approximately how long does it take on average to resolve a query? Delay on each link is 10 msec.

a. 28 b. 25 c. 23 d. 29

Ws =Wr = 3

A

F

D

C

E

B

0

A0

?

a

c

Page 5: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 5 of 13

(Q2) (5+5+5+5=20 points) Suppose within your web browser you click on a link to obtain a web page. Assume that the webpage you are fetching has 3 images located on the same server as the main webpage. Each image is a large file that fits into 10 TCP segments. The main page also fits into 1 segment. Assume that the client and server are using TCP Tahoe. The one-way propagation delay in the network is 5 msec. Ignore the size of all packets. Include the TCP termination delay. In parts (a), (b), and (c), there is no loss in the network.

(a) How long does it take to obtain the whole web page including the objects if non-persistent HTTP with no parallel TCP connections is used? Show all your work.

(b) How long does it take to obtain the whole web page including the objects if non-persistent HTTP with parallel TCP connections is used? Each image is transmitted on a separate TCP connection. Show all your work.

TCP SYN

GET main

TCP FIN

GET 1

1 2 4 3

TCP FIN

TCP SYN

Repeated Three times

Total Delay = 3 RTT + 3 X 6 RTT = 21 RTT = 210 msec

TCP SYN

GET main

TCP FIN

GET 1

1 2 4 3

TCP FIN

TCP SYN

Three times

Total Delay = 2 RTT + 6 RTT = 8 RTT = 80 msec

Three parallel Connections

H

S

H

S1

Page 6: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 6 of 13

(c) How long does it take to obtain the whole web page including the objects if persistent HTTP without pipelining is used? Parallel TCP connection is not allowed. Show all your work.

(d) In part (c) assume that the 8th segment from server to client arrives with error. All

previous and subsequent packets arrive with no-error. How long does it take to obtain the whole web page and the objects? Show all your work.

GET main

TCP FIN

GET 1

1 2 4 4

TCP SYN

Total Delay = 8 RTT = 80 msec

GET 2

10

GET 3

10

H

STCP FIN

GET main

GET 1

1 2 4 3/4

TCP SYN

Total Delay = 12 RTT = 120 msec

1

H

S

TCP FIN

first packet in error

cwnd = 1, and only 1 outstanding packet from

object 1Threshold = 4

GET 2

2 4 4

GET 3

5

TCP FIN

object 1 fully received

cwnd = 2cwnd = 4

cwnd = 5

cwnd = 5

5

congestion avoidanceslow start

Page 7: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 7 of 13

(Q3) (5+5+5+5=20 points) In the following network, node S transmits packets that pass through a tandem network of 16 routers, and arrive at the destination D. The bit rate of all links is R = 1 Mbit/sec. The maximum packet size in the network is 500 Bytes. Ignore the header size. The one-way propagation delay on each link is 10 msec. Assume that there is no error in transmission in the network, and the size of ACK packets is negligible.

(a) How long does it take to send a packet from S to D if all routers are store-and-

forward?

T = 500×8106 = 4msec

τ =10msecN =16 routersDelay = (N +1)(T +τ ) =17×14 = 238msec

(b) How long does it take to transmit a file of size 50,000 Bytes if S and D use Stop-and-Wait ARQ and all routers are store-and-forward? Include the last ACK in your calculation. 50000500

=100 packets

T1 = (N +1)(T +τ )+ (N +1)τ = 238+17×10 = 408msecT100 =100T1 = 40800msec = 40.8sec

1 162

S D

Page 8: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 8 of 13

(c) Assume that S and D use Stop-and-Wait ARQ, and that 8 routers are cut-through, and the rest are store-and-forward. How long does it take to transmit a file of size 50,000 Bytes? Include the last ACK in your calculations.

N2+1

!

"#

$

%&T + 2 N +1( )τ

'

()

*

+,×100 = 9× 4+ 2×17×10( )×100

= 376×100 = 37600msec = 37.6sec

(d) In part (c) assume that S and D use the Go-Back-5 ARQ. Find the total time to transmit the file. Include the last ACKs in your calculations.

100

5= 20 rounds

prop delay = 2×17×10 = 340 msec#CT Routers = 8# SF Routers = 8Delay of one round = 9T +340 = 376msecTotal Delay = 376×20+ 4T = 7536msec = 7.536sec

S

R1

R2

R16

DT

4T1 round

Page 9: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 9 of 13

(Q4) (10+10=20 points) In the figure below, TCP Reno transmits packet with the given sequence numbers. At time T1, EstimatedRTT = 16msec, and DevRTT= 8msec. All times on the figure are in msec. Maximum Segment Size (MSS) in the network is 250 Bytes. In the diagram, n refers to a byte number. EstimatedRTT (new) = 0.875 * EstimatedRTT (old) + 0.125 * SampleRTT DevRTT (new) = 0.75 * DevRTT (old) + 0.25 * |SampleRTT - EstimatedRTT (old)| TimeoutInterval = EstimatedRTT (new) + 4 * DevRTT (new)

a) If the congestion window size at time T1 is 1000 Bytes and the TCP is in congestion

avoidance mode, find the congestion window size in bytes at times T5 and T6. At T1: cwnd = (1000 / 250) = 4 MSS Since TCP is in slow start mode, increment cwnd by 1 MSS for each received Ack. At T2: cwnd = 5 MSS = 1250 Bytes At T3: cwnd = 6 MSS = 1500 Bytes At T4: cwnd = 6 MSS = 1500 Bytes (since no ack is received at T4, cwnd remains the same)

b) If the congestion window size at time T1 is 1000 Bytes and the TCP is in congestion avoidance mode, find the congestion window size in bytes at times T5 and T6.

Since TCP is in congestion avoidance mode, increment cwnd by (1 MSS / cwnd) for each received ack. At T5: 4 packets have been acknowledged. Hence, increment cwnd by 1 MSS. cwnd = 5 MSS = 1250 Bytes (Note: although the ack at T4 is lost, but since TCP uses commulative acks, that packet is acknowledged at T5) At T6: Timeout. Hence, cwnd = 1 MSS = 250 Bytes

n n+250

Ack(n+1) Ack(n+251)

X

168 Z

T1

X

16

T2 T3 T4 T5 T6

n+500 n+750

Ack(n+501) Ack(n+751)

Page 10: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 10 of 13

c) Find the value of Z. At T2: EstimatedRTT (new) = 0.875 X 16 + 0.125 X 8 = 15 msec DevRTT (new) = 0.75 X 8 + 0.25 X 8 = 8 msec At T3: EstimatedRTT (new) = 0.875 X 15 + 0.125 X 16 = 15.125 msec DevRTT (new) = 0.75 X 8 + 0.25 X 1 = 6.25 msec At T4: No ack received, so no calculations for EstimatedRTT or DevRTT At T5: EstimatedRTT (new) = 0.875 X 15.125 + 0.125 X 16 = 15.23 msec DevRTT (new) = 0.75 X 6.25 + 0.25 X 0.875 = 4.9 msec Z = Timeout Interval = 15.23 + 4 X 4.9 = 34.86 msec

Page 11: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 11 of 13

(Q5) (5+5+5+5=20 points) Canadian Broadcasting Corporation (CBC) has a website located in Toronto that maintains the entire newscast. There is a direct connecting link between Toronto and Vancouver. Assume that one-way propagation delay on the Vancouver-Toronto link is 100 msec and the bandwidth of the link is 10 Mbps. Further assume that the connection between any client in BC and the router R1 in Vancouver is 10 msec. All queries from BC are sent to Toronto on the R1-R2 link. On Average, the requests from BC to view the news webpage arrive at the rate of 620 requests per second and the newscast

webpage is 2000 Bytes. Ignore the header size.

(a) Find the utilization of the Toronto-Vancouver link ρ =aLR

!

"#

$

%& .

ρ =aLR=620×2000×810×106

= 0.992

(b) Assume that the queuing delay on the Toronto-Vancouver link is given by ρL

1− ρ( )R where ρ is the utilization, L is the packet size, and R is the transmission

rate. What is the total average delay in viewing the news webpage? Delay is the total time it takes from the moment the CBC server in Toronto sends a packet until the packet arrives at the client in BC.

queuing delay = ρL(1− ρ)R

=0.992×2000×8(1− 0.992)×107 =198 msec

total propagation delay = 2(5+10) = 30 msec

total transmission delay = 2000×8107 +

2000×8109 =1.6 msec

Total Avg Delay = 198 + 30 + 1.6 = 229.6 msec

10 msec

100 msecR1

R2

Page 12: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 12 of 13

(c) Assume that the capacity of the Toronto-Vancouver link is increased to 100 Mb/sec. Find the total delay in part (b).

ρ =620×2000×8

108 = 0.099

queuing delay = ρL(1− ρ)R

=0.099×2000×8(1− 0.099)×108 = 0.0176 msec

total propagation delay = 2(5+10) = 30 msec

Total Avg delay = 30 + 2000×8108 +

2000×8109 = 30.16 msec

(d) Now assume that CBC creates a local webpage in Vancouver that only contains the local news. All other news are still maintained in Toronto. Assume that on average 30% of the requests are for local news, which can be served in the Vancouver site. What would be the total average delay in fetching news? (R = 10 Mbit/sec) 70% of requests go to Torontoρ = 0.7×0.992 = 0.694

queuing delay = ρL(1− ρ)R

=0.694×2000×8(1− 0.694)×107 = 3.6 msec

Total delay for 70% = 30 + 3.6 + 1.6 = 35.2 msecTotal delay for 30% ≈ 10 msecTotal Avg delay = 0.3 × 10 + 0.7 ×35.2 = 27.64 msec

Page 13: MidtermECE361-midterm-2015F-solutionexams.skule.ca/...621448076406MidtermECE361-2015F... · Midterm – ECE361F – 2015 Page 3 of 13 5. To resolve the IP address of a server, the

Midterm – ECE361F – 2015 Page 13 of 13