Communication Networks (2nd Edition) Chapter 5 Solutions Solutions follow questions: a. Reexamine Figure 5.10 and Figure 5.11 with respect to error events that can take place and explain how these events are handled so that connection setup can take place reliably. Fundamentally, the problem involves getting the receiver state to change from an idle state to a connected state. This is the same as getting the state to go from state (0,0) to state (1,1) in Figure 5.10. Therefore transmissions of the SETUP message must be accompanied by the start of an associated timer to trigger retransmissions. Also, the receiver must acknowledge every SETUP frame that it receives. The sender should ignore redundant SETUP acknowledgments and the receiver should ignore redundant SETUP frames. In order to allow multiple connections, each flow’s SETUP and acknowledgment frames should be indexed. In the absence of connection indexing, the link should only handle one SETUP at a time until the SETUP is confirmed through an acknowledgment. Otherwise ambiguities in terms of what frame an ACK corresponds to will arise. b. To terminate the connection, either data link layer can send a DISC frame that is then acknowledged by an unnumbered acknowledgment. Discuss the effect of the above error events and how they can be dealt with. This problem is very similar to problem a. except that in the SETUP problem the actual transfer of frames cannot begin until a SETUP acknowledgment is received. In the disconnect case, the sender can stop transmitting after a certain number of retransmissions of the DISC message. c. Suppose that an initiating station sends a SETUP frame twice but that the corresponding ACK frames are delayed a long time. Just as the ACK frames from the original transmissions are about to arrive, the initiating station gives up and sends a DISC frame followed by another SETUP frame. What goes wrong if the SETUP frame is lost? If the first delayed ACK frame arrives after the initiating station sends the DISC frame and the second delayed ACK frame arrives after it sends the SETUP frame, the initiating station will assume the connection is established. Meanwhile the receiver receives the DISC frame and disconnects the connection and because the last SETUP frame is lost it remains in this state. To resolve this problem the initiating station should not send out SETUP messages with DISC messages outstanding. 15. A 1 Mbyte file is to be transmitted over a 1 Mbps communication line that has a bit error rate of p = 10−6. Q3 Solutions follow questions: The file length n = 8 x 106 bits, the transmission rate R = 1 Mbps, and p = 10-6. a. What is the probability that the entire file is transmitted without errors? Note for n large and p very small, (1 − p)n ≈ e−np. P[no error in the entire file] = (1 – p)n ≈ e–np , for n >> 1, p << 1 = e-8 = 3.35 x 10-4 We conclude that it is extremely unlikely that the file will arrive error free. b. The file is broken up into N equal-sized blocks that are transmitted separately. What is the probability that all the blocks arrive correctly without error? Does dividing the file into blocks help? A subblock of length n/N is received without error with probability: P[no error in subblock] = (1 – p)n/N Leon-Garcia/Widjaja 8 Communication Networks (2nd Edition) Chapter 5 Solutions A block has no errors if all subblocks have no errors, so P[no error in block] = P[no errors in subblock]N =((1 – p)n/N)N = (1 – p)n So simply dividing the blocks does not help. c. Suppose the propagation delay is negligible, explain how Stop-and-Wait ARQ can help deliver the file in error-free form. On the average how long does it take to deliver the file if the ARQ transmits the entire file each time? Refer to the following figure for the discussion. tACK tf ACK/NAK We assume the following: • • • • • • t0 = basic time to send a frame and receive the ACK/NAK ≈ ttimeout ttotal = total transmission time until success nf = number of bits/frame na = number of bits per ACK nt = number of transmissions Pf = probability of frame transmission error t0 = tf + tACK = nf /R + na /R (tprop ≈ 0). P[nt = i ] = P[one success after i – 1 failure] = (1 – Pf) Pf i – 1 ttotal | i transmissions = i.t0 ∞ ∞ i =1 i =1 E[ttotal] = ∑ it 0 P[nt = i ] = t 0 (1 − Pf )∑ iPf i −1 = t 0 (1 − Pf ) / (1 − Pf ) =t 0 / (1 − Pf ) 2 Here, nf = n >> na thus t0 ≈ tf = n/R ; and Pf = 1 – P[ no error] = 1 – e–np E[total] = n/R (1 – Pf) = n/[Re–np] = 8 / (3.35 x 10–4) = 23,847 seconds = 6.62 hours! The file gets through, but only after many retransmissions. d. Now consider breaking up the file into N blocks. (Neglect the overhead for the header and CRC bits.) On the average how long does it take to deliver the file if the ARQ transmits the blocks one at a time? Evaluate your answer for N = 80, 800, and 8000. For 1 block Pf = 1 – Pb = 1 – (1 – p)n/N and nf = n/N if tprop ≈ 0 and na << n/N : t0b = nf/R = n/NR Leon-Garcia/Widjaja 9 Communication Networks (2nd Edition) Chapter 5 Solutions Tb = E[ttotalb] = t0b / (1 – Pf) = n(1 – p)–n/N /NR average time to transmit one block T = E[ttotal] = N Tb = n(1 – p)–n/N /R = 8 (1 – p) –n/N = 8 enp/N if n/N >> 1, p << 1 • • • N = 80 ⇒ T ≈ 8 e0.1 = 8.84 sec N = 800 ⇒ T ≈ 8 e0.01 = 8.08 sec N = 8000 ⇒ T ≈ 8 e0.001 = 8.008 sec Each subblock has a higher probability of arriving without errors, and so requires fewer retransmissions to deliver error free. The overall delay is reduced dramatically. e. Explain qualitatively what happens to the answer in part (d) when the overhead is taken into account. As N increases, the effect of overhead becomes more significant because the headers constitute a bigger fraction of each subblock. 16. Consider the state transition diagram for Stop-and-Wait ARQ in Figure 5.12. Let Pf be the probability of frame error in going from station A to station B and let Pa be probability of ACK error in going from B to A. Suppose that information frames are two units long, ACK frames are one unit long, and propagation and processing delays are negligible. What is the average time that it takes to go from state (0,0) to state (0,1)? What is the average time that it then takes to go from state (0,1) to state (1,1)? What is the throughput of the system in information frames/second? Solution: We know that Pf is the probability of frame error and Pa is the probability of ACK error. We assume that: • • • X is the random variable that represents the number of trials before a successful transmission of a frame. Each unsuccessful trial requires a timeout for retransmission. We assume that the timeout time is set to be equal to frame transmission time plus ACK transmission time. Y is the random variable that represents the number of trials before a successful transmission of an ACK. An ACK error will require a new successful retransmission of the frame for next ACK transmission. An ACK is not sent until a new retransmitted frame arrives at the receiver. X and Y follow a geometric random-variable distribution. T1 = Average time to go from (0,0) to (0,1) = (Tf + Ta) E(X) + Tf T 1 = (2 + 1) P P 2 + Pf P 2 + 2 = 2 f + 1 + f = + f = 1 − Pf 1 − Pf 1 − Pf 1 − Pf 1 − Pf 1 − Pf Pf T2 = Average time to go from (0,1) to (1,1) = T1E(Y) +Ta 2 + Pf Pa T 2 = T1 T + = a 1 − Pa 1 − Pf Pa +1 1 − Pa Throughput = Frame Time / Expected Total Transmission Time = 2 / (T1 + T2) Pf 0.2 0.02 0.002 0 Leon-Garcia/Widjaja Pa T1 T2 Throughput 0.1 0.01 0.001 0 2.75 2.06 2.006 2.0000 1.3055 1.0208 1.0020 1.0000 0.4931 0.6492 0.6649 0.6667 10 Communication Networks (2nd Edition) Chapter 6 Solutions Q45. Let G be the total rate at which frames are transmitted in a slotted ALOHA system. What proportion of slots goes empty in this system? What proportion of slots go empty when the system is operating at its maximum throughput? Can observations about channel activity be used to determine when stations should transmit? Solution: Proportion of empty slots = P[0 transmission] = [G0/0!]e−G = e−G Maximum throughput = 0.368; Gmt = 1 Proportion of empty slots at maximum throughput = e−1 = 0.368 Any attempt to decrease the proportion of empty slots below e-1 is counterproductive as this action will push the throughput below its maximum value. 6. Modify the state transition diagram of Stop-and-Wait ARQ to handle the behavior of a station that implements the ALOHA protocol. Solution: transmit timeout back off ack ready 7. Suppose that each station in an ALOHA system transmits its frames using spread spectrum transmission. Assume that the spreading sequences for the different stations have been selected so that they have low crosscorrelations. What happens when transmissions occur at the same time? What limits the capacity of this system? Solution: The transmitted signals from different stations occupy the whole frequency band simultaneously. To each receiver, the aggregate of the other signals appears like noise after the receiver applies its spreading sequence in the demodulation. Consequently, the receiver can reliably extract its desired signal as long as the signal to noise ratio remains sufficiently high. The system capacity is limited by the maximum amount of signal interference allowed at the receiver. Increasing the number of signals in the system increases the interference power level. As the number of signals is increased, the SNR decreases and the bit error rate in each receiver will increase. 8. Consider four stations that are all attached to two different bus cables. The stations exchange fixed-size frames of length 1 second. Time is divided into slots of 1 second. When a station has a frame to transmit, the station chooses either bus with equal probability and transmits at the beginning of the next slot with probability p. Find the value of p that maximizes the rate at which frames are successfully transmitted. Leon-Garcia/Widjaja 2 Communication Networks (2nd Edition) Chapter 6 Solutions Q5 Solution: To maximize the successful transmission rate is to maximize the probability of successful transmission. P(success) = (number of stations) × P(one station transmits on one bus) × P(no other station transmit on the same bus) = 1 1 1 4( p)( 1 − p)3 = 2 p( 1 − p)3 2 2 2 Take the derivative with respect to p, ∂P( success) 1 1 = 2(1 − p)3 − (3 p)(1 − p) 2 ∂p 2 2 set it to 0 and find the value of p= p that maximizes P(success). 1 2 9. In a LAN, which MAC protocol has a higher efficiency: ALOHA or CSMA-CD? What about in a WAN? Solution: The maximum efficiency achieved by the Slotted ALOHA is 0.368. The efficiency of CSMA-CD is given by 1/(1 + 6.4a), and is sensitive to a = tpropR/L, the ratio between delay-bandwidth product and frame length. In a LAN environment, the end-to-end distance is around 100m and the transmission rates are typically 10Mbps, 100Mbps and 1Gbps (See Table 6.1). An Ethernet frame has a maximum length of 1500 bytes = 12,000 bits. The table shows the efficiency of CSMA-CD at various transmission rate. Assume L = 12,000 bits and propagation speed of 3 x 108. 10 Mbps 100 Mbps 1 Gbps a 3 x 10-4 3 x 10-3 3 x 10-2 Efficiency 0.998 0.981 0.839 Note however that if shorter frame sizes predominate, e.g. 64 byte frames, then a increases by a factor of about 20. According to the above formula the efficiency of CSMA-CD at 1 Gbps then drops to about 0.7. The situation however is worse in that the minimum frame size at 1 Gbps needs to be extended to 512 bytes, as discussed in page 436 of the text. In a WAN environment d is larger. Assuming 100 Km, a is larger by a factor of 103 resulting in an efficiency of 0.36, 0.05, and 0.005 respectively for 10 Mbps, 100 Mbps, and 1 Gbps transmission rates. In the case of 10 Mbps transmission rate the efficiency of CSMA-CD is close to the efficiency of ALOHA but in the other two cases it is much less than ALOHA. Leon-Garcia/Widjaja 3 Communication Networks (2nd Edition) Chapter 6 Solutions Q6 10. A channel using random access protocols has three stations on a bus with end-to-end propagation delay τ. Station A is located at one end of the bus, and stations B and C are together located at the other end of the bus. Frames arrive at the three stations and are ready to be transmitted at stations A, B, and C at the respective times tA = 0, tB = τ/2, and tC = 3τ/2. Frames require transmission times of 4τ. In appropriate figures, with time as the horizontal axis, show the transmission activity of each of the three stations for Frame arrival times: A: tA = 0 B: tB = τ/2 C: tC = 3τ/2 = 1 1/2 τ tp = τ and X = 4τ a. ALOHA collision A 0 1τ 2τ 3τ 4τ 5τ 6τ 7τ 8τ No ACK; A times out, reschedules No ACK; B times out, reschedules collision B 0 1τ 2τ 3τ 4τ 5τ 6τ 7τ 8τ 7τ No ACK; C times out, 8τ reschedules collision C 0 b. 1τ 2τ 3τ 4τ 5τ 6τ Non-persistent CSMA collision A 0 1τ 2τ 3τ 4τ 5τ 6τ 7τ 8τ No ACK; A times out, reschedules No ACK; B times out, reschedules collision B 0 1τ 2τ 3τ 4τ 2τ 3τ 4τ 5τ 6τ 7τ 8τ 6τ 7τ 8τ C 0 1τ 5τ Station C senses channel busy and backs off Leon-Garcia/Widjaja 4 Communication Networks (2nd Edition) c. Chapter 6 Solutions Non-persistent CSMA-CD. collision A 0 1τ 2τ 3τ 4τ 5τ 6τ 7τ 8τ 5τ 6τ 7τ 8τ 6τ 7τ 8τ A detects collision, aborts collision B 0 1τ 2τ 3τ 4τ B detects collision, aborts C 0 1τ 2τ 3τ 4τ 5τ Station C senses channel busy and backs off 11. Estimate the maximum throughput of the CDPD system assuming packets are 1096 bytes in length. Hint: What is a for this system? Solution: During the contention interval, it takes two microblock delays (2tµblock) for a station to know if it has captured the reverse channel. Divide the time into minislots of 2tµblock. As in the CSMA-CD system, the maximum probability of successful transmission is Psuccess = max the average number of minislots in a contention period is E[ J ] = 1 max success P 1 , and e = e. The maximum throughput occurs when the channel time is spent in packet transmission followed by a contention period. After the packet transmission E[X], each station spends one tµblock to determine if the channel is idle or busy. The maximum throughput is given by ρ max = t E[ X ] 1 = where a = ublock . E[ X ] + t ublock + e(2t ublock ) 1 + (2e + 1)a E[ X ] Calculation: t ublock = 60bits = 3.1ms 19,200bps Assume the packet is already in HDLC format. 1096 bytes = 8768 bits Packet length after segmentation and header insertion: Leon-Garcia/Widjaja 5