434 HW 3 Sol
434 HW 3 Sol
434 HW 3 Sol
1.
(3.11) A 12-bit Hamming code whose hexadecimal value is 0xE4F arrives at a receiver. What was the original value in hexadecimal? Assume that not more than 1 bit is in error. 0xE4F=1110 0100 1111
Position Pos. as power of 2 1 1 2 2 3 2+1 4 4 5 4+1 6 4+2 7 4+2+1 8 8 9 8+1 10 8+2 11 8+2+1 12 8+4 Parity Result
Bitstream
Check bit #1 Parity Check bit #2 Parity Check bit #4 Parity Check bit #8 Parity
1 1
1 1
1 1 1
0 0 0
1 1 1
0 0 0 0
0 1 1
1 1
1 1 1 1
0 1
1 1
The second bit is incorrect. So the original value is 1010 0100 1111, i.e. 0xA4F. Dada: 1010 1111, i.e. 0xAF (3.14) What is the remainder obtained by dividing x 7 + x 5 + 1 by the generator polynomial x 3 + 1 ? M(x) = x 7 + x 5 + 1 G(x) = x 3 + 1 Since degree of G(x) is r = 3, append 3 zero bits to the lower end of M(x). Frame: 10100001 Generator: 1001 Message after 3 zero bits are appended: 10100001000
2.
(3.19) In protocol 3, is it possible that the sender starts the timer when it is already running? If so, how might this occur? If not, why is it impossible? Yes, this can happen. This is the case when "no positive ack arrives" at the sender in last iteration of the while loop in sender3(void) code on page 210. So, the frame that the sender is transmitting when the timer is running (and therefore reset), is a repeat/duplicate frame.
(3.20) Imagine a sliding window protocol using so many bits for sequence numbers that wraparound never occurs. What relations must hold among the four window edges and the window size, which is constant and the same for both the sender and the receiver. S1: senders lower edge S2: senders upper edge R1: receivers lower edge R2: receivers upper edge W: window size There are three main conditions that must hold among the four window edges and the window size: 1. The sender must keep track of 0 to w frames that have currently been sent but have no acknowledgment i.e outstanding. 0 <= S2 S1 + 1 <= W 2. The receiver will expect up to w frames. R2 R1 + 1 = W
3. The receivers sequence number must be within the senders window S1 <= R1 <= S2 + 1
3.
(3.33) Suppose that we model protocol 4 using the finite state machine model. How many states exist for each machine? How many states exist for the communication channel? How many states exist for the complete system (two machines and the channel?) Ignore the checksum errors. Each machine has frame_expected, next_frame_to_send fields, so each machine has 4 possible states. With nothing on the channel: one state. With one message on the channel: this massage can be sent by station 1 or station 2, and this message can be Ack 0 or 1, and Seq 0 or 1. So here we have 8 states. With two messages on the channel: these two must be sent by different stations. Similarly, each of the messages can be from 4 possibilities: ACK0 or 1, and Seq0 or1. So 4X4=16 states in this case. So, there are 1+ 8 +16 = 25 possible states on a channel. And the complete system has 25x4x4=400 possible states.
4.
(4.3) Consider the delay of pure ALOHA versus slotted ALOHA at low load. Which one is less? Explain your answer. At low load, the delay of pure ALOHA is less than that of slotted ALOHA. This is because in slotted ALOHA, when a message is ready, the station has to wait until the beginning of the next slot, but in pure ALOHA, the station can sent at any time a message is ready.
(4.8) How long does a station s have to wait in the worst case before it can start transmitting its frame over a LAN that uses (a) the basic bit-map protocol? The worst case would be when a station wants to transmit (just after its bit slot is passed), and all of the other stations are transmitting. Then, on the next pass all the stations are transmitting again, and station, s, is the very last station on the map. So first it has to wait for (N-1) frame slot, then entire N bit-slot (contention period), and another (N-1) frame slot, so total waiting time is N+2(N-1)d bit slots. (b) Mok and Wards protocol with permuting virtual station numbers?
As an example of the worst case scenario with the Mok and Ward protocol, consider 8 stations arranged in virtual priority order of A, B, C, D, E, F, G, S with priority (7,6,5,4,3,2,1,0). The worst case will occur when every station wants to transmit a frame. The protocol will allow every station in front of S to transmit, shifting S towards the front of the line one step at a time. So S will be forced to wait through N contention countdowns, each of which takes log 2 N bits to complete. After each countdown, one frame will be transmitted. So in total, S will have to wait through N contention countdowns and N-1 frame transmissions of length d bits as each other station goes ahead of S. In total, this takes (N log 2 N ) + (N-1)d bits in the worst case. 5. (4.10) Sixteen stations, numbered 1 through 16, are contending for the use of a shared channel by using the adaptive tree walk protocol. If all the stations whose addresses are prime numbers suddenly become ready at once, how many bit slots are needed to resolve the contention? Prime numbers less than 16 are 2,3,5,7,11, 13. In this case, stations 2, 3, 5, 7, 11, 13 are contending for access to the shared channel. Each step will represent a bit slot needed to resolve the contention for each transmitting station.
A
10
11
12
13
14
15
16
A is tested and encounters a collision from 2, 3, 5, 7, 11, 13. B is tested and encounters a collision from 2, 3, 5, 7. D is tested and encounters a collision from 2 and 3. H is tested and 2 transmits uncontested. I is tested and 3 transmits uncontested.
E is tested and encounters a collision from 5 and 7. J is tested and 5 transmits uncontested. K is tested and 7 transmits uncontested. C is tested and encounters a collision from 11 and 13. F is tested and 11 transmits uncontested. G is tested and 13 transmits uncontested.
After all these tests are complete, there are no more contentions that need to be resolved. This process took 11 bit slots to complete.
(4.11) A collection of 2 n stations uses the adaptive tree walk protocol to arbitrate access to a shared cable. At a certain instant, two of them become ready. What are the minimum, maximum, and mean number of slots to walk the tree if 2 n >> 1 ? Minimum: The best case is that the two stations are the first and last station (say 1 and 2 n ). The only common ancestor is the root node, level 0. So it needs 3 slots. Maximum: If two stations have the same parent, it takes 2n+1 slots to walk the tree and this is the maximum number of slots to walk the tree. Mean: The probability that we need to go i level back in the tree to find a common ancestor of 1 the two stations is n i+1 , and the number of slots to walk the tree is 2(n - i +1) + 1. 2 n 1 So the mean number of slots to walk the tree is ni +1 [ 2( n i + 1) + 1] i =1 2