关键词 > COMP/ELEC429/556

COMP/ELEC 429/556 Spring 2022 Homework #1

发布时间:2022-02-22

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP/ELEC 429/556 Spring 2022

Homework #1

Problem 1 (20 points) – A student wants to measure as accurately as possible the time it takes to send 1GB, in 10KB chunks, to a remote computer using a SOCK_STREAM socket. To do so, he     writes a sender program which contains the following code fragment:

/* some standard code to create a socket

* and to establish a connection

*/

... code omitted ...

fcntl(send_socket, F_SETFL, O_NONBLOCK);

gettimeofday(&start, NULL);

for (i=0; i<100000; i++) {

chunk = malloc(10000);

send(send_socket, chunk, 10000, 0);

free(chunk);

}

gettimeofday(&end, NULL);

/* compare start and end to obtain

* the elapsed time

*/



There are two fundamental design flaws in this code fragment. One causes the program to           sometimes send fewer than 1GB. Another one causes the program to be very inaccurate. Identify these flaws and provide a revised code fragment that removes these flaws. You may find the man pages on CLEAR for the various system calls useful.




Problem 2 (10 points) The weakness of the NRZI bit representation scheme is that a long sequence of 0’s in the input bit stream will cause the electrical signal to contain no            voltage transition for a long period of time, thus making it difficult for the receiver to detect clock drifts. One solution to this problem is to translate the input bit stream into an             encoded bit stream that eliminates long sequences of 0’s.

Design a way to translate every 3-bit sequence in the input bit stream to a 4-bit encoded sequence such that the resulting encoded bit stream is guaranteed to contain no more    than 2 consecutive 0’s. Write down your answer in the space below.


3-bit input sequence



000


001


010


011


100


101


110


111


4-bit encoded sequence


Problem 3 (29 points) -- Suppose you are designing a multi-access (i.e. broadcast) wired network using CSMA/CD (Carrier Sense Multiple Access/Collision Detect) mechanisms similar to the         Ethernet for media access control. Assume that in your design, the network’s link speed is            15Mbps, frame sizes may range from 200 bytes to 2000 bytes. Also assume that data signal         propagates on the network link at a speed of 2*108  meters per second.

(a)To guarantee that a collision is detected, what is the maximum allowable link length (in meters) between any pair of hosts connected to the same link? Show your work. (15 points)




(a)State the reasons why broadcast Ethernet, where all hosts on the network share one single      channel (i.e. wire) and CSMA/CD (carrier sense multiple access/collision detect) is used to           arbitrate media access among the hosts, cannot (1) support a large number of hosts and still        maintain high throughput, or (2) support hosts spread across a large geographic area. (14 points)


Problem 4 (20 points) Consider a bridged Ethernet shown below. There are 4 computers A, B, C, and D in the network. The ports of bridge B6 are labeled p0, p1, p2, p3 respectively. The bridge   IDs are the numeric values. Assume the forwarding tables of all bridges are currently empty.

(a) Indicate which ports are blocked by the bridge spanning tree protocol by putting an “X” over the corresponding ports. (10 points)

(b) With the spanning tree established, suppose A transmits a single packet addressed to B, and C transmits a single packet addressed to D. Explain how the Ethernet bridges forward these       packets and how they learn forwarding table entries. Use the space on the next page to write      your answer. (7 points)

(c) After the transmissions of the two packets have been completed and the network is idle, what is the content of the forwarding table at bridge B6? (3 points)




D







p0       p1

p3       p2


B





A



(blank page for answer)


Problem 5 (21 points): Suppose Sammy is designing a new sliding window based reliable         transport protocol for use in the Internet. In particular, in Sammy’s design, he uses (i) a 4 bit     packet sequence number to label each packet, (ii) a retransmission timeout of 20ms, and (iii) a window size of 14 packets.

Provide three detailed reasons in terms of the protocol’s correctness or performance to argue that Sammy’s design is a poor design.













7