ECE358: Computer Networks Spring 2012

18
ECE358: Computer Networks Spring 2012 Solutions to Homework #2

description

ECE358: Computer Networks Spring 2012. Solutions to Homework #2. - PowerPoint PPT Presentation

Transcript of ECE358: Computer Networks Spring 2012

Page 1: ECE358: Computer Networks Spring 2012

ECE358: Computer NetworksSpring 2012

Solutions to Homework #2

Page 2: ECE358: Computer Networks Spring 2012

2

P 1. Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What would the value of the field containing the parity bits be for the case of a two-dimensional parity scheme? Your answer should be such that a minimum-length checksum field is used.

1 1 1 0 1

0 1 1 0 0

1 0 0 1 0

1 1 0 1 1

1 1 0 0 0

To get a minimum –length checksum field ( minimum parity bits), the two-dimensional parity scheme should be 4x4.

In the two-dimensional even parity scheme, the values of the parity bits are set such that the number of 1s in each of the ellipses shown is even.

Page 3: ECE358: Computer Networks Spring 2012

3

P 2. Show (give an example) that two-dimensional parity checks can correct and detect a single bit error. Show (give an example of) a double-bit error that can be detected but not corrected

1 1 1 0 1

0 1 1 0 0

1 0 0 1 0

1 1 0 1 1

1 1 0 0 0

Sent Frame Received Frame w/ 1 error1 1 1 0 1

0 0 1 0 0

1 0 0 1 0

1 1 0 1 1

1 1 0 0 0

The error can be detected and corrected.

1 1 1 0 10 0 1 0 01 0 1 1 01 1 0 1 11 1 0 0 0

Received Frame w/ 2 error

Errors can be detected but cannot be corrected.

Page 4: ECE358: Computer Networks Spring 2012

4

P 5. Consider the 5-bit generator, G=10011, and suppose that D has the value 1010101010. What is the value of R (R is the CRC)?

1 0 1 0 1 0 1 0 1 0 0 0 0 01 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0

D.2r

G

CRC

Page 5: ECE358: Computer Networks Spring 2012

5

P 6. Consider the previous problem, but suppose that D has the value a. 1001010101. b. 0101101010. c. 1010100000.

CRC

a.

1 0 0 1 0 1 0 1 0 1 0 0 0 01 0 0 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0

Page 6: ECE358: Computer Networks Spring 2012

6

0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1

Continuing P 6.

CRC

b.

Page 7: ECE358: Computer Networks Spring 2012

7

1 0 1 0 1 0 0 0 0 0 0 0 0 01 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1

Continuing P 6.

CRC

c.

Page 8: ECE358: Computer Networks Spring 2012

8

P 8. In the class, we provided an outline of the derivation of the efficiency of slotted ALOHA. In this problem we'll complete the derivation. a. Recall that when there are N active nodes, the efficiency of slotted ALOHA is Np( 1 -p)N-1. Find the value of p that maximizes this expression.b. Using the value of p found in (a), find the efficiency of slotted ALOHA by letting N approach infinity. Hint: (1 - 1/N)N approaches as N approaches infinity.

a. At the stationary points of , =0 =0 Either or [ For (minima) For [ = (Maximum)b. Efficiency

Page 9: ECE358: Computer Networks Spring 2012

9

P 10. Consider two nodes, A and B, that use the slotted ALOHA protocol to contend for a channel. Suppose node A has more data to transmit than node B, and node A’s retransmission probability is greater than node B's retransmission probability . a. Provide a formula for node A's average throughput. What is the total efficiency of the protocol with these two nodes? b. If pA = 2pB is node A's average throughput twice as large as that of node B? Why or why not? If not, how can you choose pA and pB to make that happen? c. In general, suppose there are N nodes, among which node A has retransmission probability 2p and all other nodes have retransmission probability p. Provide expressions to compute the average throughputs of node A and of any other node.

b. clearly, A’s throughput 2 B’s throughput In order to make =2 c.

Page 10: ECE358: Computer Networks Spring 2012

10

P 11. Suppose four active nodes—nodes A, B, C and D—are competing for access to a channel using slotted ALOHA. Assume each node has an infinite number of packets to send. Each node attempts to transmit in each slot with probability p. The first slot is numbered slot 1, the second slot is numbered slot 2, and so on. a. What is the probability that node A succeeds for the first time in slot 5? b. What is the probability that some node (either A, B, C or D) succeeds in slot 4? c. What is the probability that the first success occurs in slot 3? d. What is the efficiency of this four-node system?

a. ,

b. c.

Page 11: ECE358: Computer Networks Spring 2012

11

P 12. Graph the efficiency of slotted ALOHA and pure ALOHA as a function of p for the following values of N: a. N=15. b. N=25. c. N=35.

𝐸𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑐𝑦=𝑁𝑝 (1−𝑝 )2 (𝑁−1 )

Page 12: ECE358: Computer Networks Spring 2012

12

Continuing P 12.

𝐸𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑐𝑦=𝑁𝑝 (1−𝑝 )(𝑁−1 )

Page 13: ECE358: Computer Networks Spring 2012

13

P 13. Consider a broadcast channel with N nodes and a transmission rate of R bps. Suppose the broadcast channel uses polling (with an additional polling node) for multiple accesses. Suppose the amount of time from when a node completes transmission until the subsequent node is permitted to transmit (that is, the polling delay) is . Suppose that within a polling round, a given node is allowed to transmit at most Q bits. What is the maximum throughput of the broadcast channel?

The polling- round length= sec# of bits transmitted in a polling-round= NQ bits

bit/sec

Page 14: ECE358: Computer Networks Spring 2012

14

P 17. Recall that with the CSMA/CD protocol, the adapter waits K * 512 bit times after a collision, where K is drawn randomly. For k= 100, how long does the adapter wait until returning to Step 2 for a 10 Mbps Ethernet? For a 100 Mbps Ethernet?

• For 10Mbps Ethernet waiting time • For 100Mbps Ethernet waiting time

Page 15: ECE358: Computer Networks Spring 2012

15

P 18. Suppose nodes A and B are on the same 10 Mbps broadcast channel, and the propagation delay between the two nodes is 325 bit times. Suppose CSMA/CD and Ethernet packets are used for this broadcast channel. Suppose node A begins transmitting a frame and, before it finishes, node B begins transmitting a frame. Can A finish transmitting before it detects that B has transmitted? Why or why not? If the answer is yes, then A incorrectly believes that its frame was successfully transmitted without a collision. Hint: Suppose at time t= 0 bits, A begins transmitting a frame. In the worst case, A transmits a minimum-sized frame of 512 + 64 bit times. So A would finish transmitting the frame at t = 512 + 64 bit times. Thus, the answer is no, if B's signal reaches A before bit time t = 512 + 64 bits. In the worst case, when does B's signal reach A?

At t=0 A starts transmitting. At t= 512+64=576 bit times , A would finish transmitting (in the worst case, A sends the minimum frame size so that it would finish transmitting shortly and consequently would not hear B). In the worst case, B begins transmitting at time t=324, which is the time right before the first bit of A’s frame arrives at B.At time t=324+325=649 B's first bit arrives at A. Because 649> 576, A finishes transmitting before it detects that B has already started transmitting. So A incorrectly thinks that its frame was successfully transmitted without a collision.

Page 16: ECE358: Computer Networks Spring 2012

16

t=324t=0

Continuing P 18.

10Mbps Ethernet

𝑑𝑃𝑟𝑜𝑝=325𝑏𝑖𝑡 𝑡𝑖𝑚𝑒𝑠

t=576 t=325t=901t=649

576<649 A finishes transmitting before hearing B

A B

Page 17: ECE358: Computer Networks Spring 2012

17

B’s scheduled time for

retransmission

B sends Jam

Signal (48bits)

A sends Jam

Signal (48bits)

P 19. Suppose nodes A and B are on the same 10 Mbps broadcast channel, and the propagation delay between the two nodes is 245 bit times. Suppose A and B send Ethernet frames at the same time, the frames collide, and then A and B choose different values of K in the CSMA/CD algorithm. Assuming no other nodes are active, can the retransmissions from A and B collide? For our purposes, it suffices to work out the following example. Suppose A and B begin transmission at t= 0 bit times. They both detect collisions at t =245 bit times. Suppose and . At what time does B schedule its retransmission? At what time does A begin transmission? (Note: the nodes must wait for an idle channel after returning to step 2). At what time does A’s signal reach B? does B refrain from transmitting at its scheduled time?

t=0t=0

10Mbps Ethernet

𝑑𝑃𝑟𝑜𝑝=245𝑏𝑖𝑡 𝑡𝑖𝑚𝑒𝑠

t=245+48=293t=245t=245t=293 (245+48)

t=293+245=538 t=538 (293+245)

t=538+96=634

t=879 (634+245)t=805 (293+512)

t=901 (805+96)

A B

A senses for an idle channel (96 bits)

B senses for an idle channel (96 bits)

B refrains from transmitting

Page 18: ECE358: Computer Networks Spring 2012

18

Continuing P 19.

• t=0, A and B begin transmission.• t=245, A and B detect collision.• t=293, A and B finish transmitting jam signal.• t=293+245 = 538, B's last bit arrives at A; A detects an idle

channel.• t=538+96=634, A starts transmitting• 293+512 = 805, B's scheduled time. B must sense idle channel for

96 bit times before it transmits• 634+245=879, A's transmission reaches BBecause A's retransmission reaches B before B's scheduled retransmission time (805+96), B refrains from transmitting while A retransmits. Thus A and B do not collide. Thus the factor 512 appearing in the exponential backoff algorithm is sufficiently large.