Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

CIS 527 COMPUTER NETWORKS SOLUTION HOMEWORK #2 1.

1. Sketch the NRZ, Manchester, and NRZI encoding for the bit stream 0001110101. Assume that the NRZI signal starts out low. Solution:
0 0 0 1 1 1 0 1 0 1

NRZ

0 - Low ; 1 - High

Clock

Manchester

0 - Low to High; 1 - High to Low

NRZI

Make a transition from the current signal to encode a 1 and stay at the current signal to encode a 0

2. A bit string, 0111101111101111110, needs to be transmitted at the data link layer. What is the string actually transmitted after bit stuffing? Solution: 01111011111 0 (data) (Inserted 0) 011111 (data) 0 (Inserted 0) 10 (data)

When five consecutive 1s have been transmitted from the body of the message, the sender inserts a 0 (as shown above) before transmitting the next bit. 3. A bit stream 10011101 is transmitted using the standard CRC method. The generator polynomial is x3+1. Show the actual bit string transmitted. Suppose the third bit from the left is inverted during transmission. Show that this error is detected at the receivers end. Solution: Message M (x) = 10011101 = x7+x4+ x3+ x2+ 1 CRC Polynomial C (x) = x3+ 1 = 1001 Multiply the message with x3 since the divisor polynomial is of degree 3.

T (x) = x3 (x7+x4+ x3+ x2+ 1) = x10+x7+ x6+ x5+x3 10011101000 Divide 10011101000 by 1001 i.e., divide T (x) by C (x) 1000110 --------------------------------------------| 10011101000 Message | 1001 ----------------1101 1001 --------1000 1001 ----------100 Remainder -----------

1001

Since T (x) minus the remainder would be exactly divisible by C (x), we subtract the remainder from T (x) as shown below: Note: The minus operation in polynomial arithmetic is the logical XOR operation. T (x): 10011101000 Remainder: 100 ------------------10011101100 This turns out to be the original message with ------------------the remainder appended to it. If the third bit form the left is inverted during transmission, the bit stream would be: 10111101100. Dividing this by 1001 we get: 10101 --------------------------------------------1001 | 10111101100 Message | 1001 ----------------1011 1001 --------1001 1001 -----------0100 Remainder -----------Since the remainder is 100, which is different form 0, the receiver detects the error and can ask for retransmission.

4. Draw a timeline diagram (up to frame 7) that for the sliding window algorithm with SWS=4 frames and RWS=3 frames, when the third frame (frame 2) is lost. The receiver use cumulative ACKs. Use a timeout interval of about 2 x RTT. Assuming that the transmit time (insertion delay) of a frame is equal to 0.25 RTT and the frames can be processed instantaneously if they arrive in order. On each data frame and ACK frame, you need to indicate the sequence number (start from 0). In addition, you need to indicate what action is taken by the receiver when it is received, for example, processed, buffered, and discarded. Solution: SWS = 4; RWS = 3; Timeout Interval = 2 RTT; Transmit Time = .25RTT
Frame 0 Frame 1 Frame 2 1 RTT pp Frame 3 Processed ACK 0 Processed

X
Frame 4

ACK 1

Buffered Frame 5 Buffered

Discarded

Timeout for Frame 2


Frame 2

ACK 4

Frame 5

ACK 5

5. Suppose that we run the sliding window algorithm with SWS = 5 and RWS = 3, and no out-of-order arrivals. Solution: a) Find the smallest value for MaxSeqNum. No explanation The smallest working value for MaxSeqNum is 8 It suffices to show that if DATA[8] is in the receive window, then DATA[0] can no longer arrive at the receiver. We have that DATA[8] in receive window the earliest possible receive window is DATA[6]..DATA[8] ACK[6] has been received DATA[5] was delivered. But because SWS=5, all DATA[0]s sent were sent before DATA[5] by the no-out-of-order arrival hypothesis, DATA[0] can no longer arrive. b) Give an example showing that MaxSeqNum 1 is not sufficient We show that if MaxSeqNum=7, then the receiver can be expecting DATA[7] and an old DATA[0] can still arrive. Because 7 and 0 are indistinguishable mod MaxSeqNum, the receiver cannot tell which actually arrived. 1. Sender sends DATA[0]...DATA[4]. All arrive. 2. Receiver sends ACK[4] in response, but it is slow. The receive window is now DATA[5]..DATA[7]. 3. Sender times out and retransmits DATA[0]. The receiver accepts it as DATA[7]. c) State a general rule for the minimum MaxSeqNum in terms of SWS and RWS. From the above discussion we can derive that, MaxSeqNum can be greater than or equal to the sum of SWS and RWS and cannot be less than the sum. MaxSeqNum >= SWS + RWS

6. Ethernet frames must be at least 64 bytes long to ensure the transmitter is still going in the event of a collision at the far end of the cable. Fast Ethernet has the same 64 byte minimum frame size but can get bits out 10 times faster. How is it possible to maintain the same minimum frame size? Solution: The 64 byte (512 bit) limit is based on a 2.5km long 10base5 cable. The 512 bits (equals 51.2 microseconds) is based on twice the end-to-end propagation time (about 5 microseconds per km) plus time to propagate through repeaters. Fast Ethernet has shorter cable runs (100m of cable implies about 0.5microseconds or about 50 bits at 100Mbps). For Regular Ethernet: RTT Size / BW 51.2sec Size / 10 Mbps i.e., 512 bits Size For Faster Ethernet: RTT Size / BW 5.12sec Size / 100 Mbps i.e., 512 bits Size 7. Consider a token ring network like FDDI in which a station is allowed to hold the token for some period of time (the token holding time, or THT). Let RingLatency denote the time it takes the token to make one complete rotation around the network when none of the stations have any data to send. Solution: a) In terms of THT and RingLatency, express the efficiency of this network when only a single station is active. THT / (THT + RingLatency) b) What setting of THT would be optimal for a network that had only one station active (with data to send) at a time? Infinity; we let the station transmit as long as it likes. c) In the case where N stations are active, given an upper bound on the token rotation time, or TRT, for the network TRT N THT + RingLatency

You might also like