434hw3sol

5
1 CSE 434 – TTh 9:15 AM Homework #3 Sample Solution October 14, 2003  Please email Catherine (  [email protected]  ) if you have questions. (10 points for each question)  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 t hat not more than 1 bit is in error. 0xE4F=1110 0100 1111 Pos iti on 1 2 3 4 5 6 7 8 9 10 11 12 Parity Result Pos. as power of 2 1 2 2+1 4 4+1 4+2 4+ 2+1 8 8+1 8+2 8+2 +1 8+4 Bitstrea m 1 1 1 0 0 1 0 0 1 1 1 1 Check bit #1 Parity 1 1 0 0 1 1 Even Check bit #2 Parity 1 1 1 0 1 1 Odd Check bit #4 Parity 0 0 1 0 1 Even Check bit #8 Parity 0 1 1 1 1 Even 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 t he remainder obtaine d by dividing 1 5 7 + + x  x by the generator polynomial 1 3 +  x ? M(x) = 1 5 7 + + x  x  G(x) = 1 3 +  x  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

Upload: sweet-alia

Post on 06-Apr-2018

271 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 434hw3sol

8/3/2019 434hw3sol

http://slidepdf.com/reader/full/434hw3sol 1/5

1

CSE 434 – TTh 9:15 AMHomework #3 Sample Solution

October 14, 2003

 Please email Catherine (  [email protected] ) if you have questions.

(10 points for each question) 

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 than1 bit is in error.

0xE4F=1110 0100 1111

Position 1 2 3 4 5 6 7 8 9 10 11 12 Parity ResultPos. as power of 2 1 2 2+1 4 4+1 4+2 4+2+1 8 8+1 8+2 8+2+1 8+4

Bitstream 1 1 1 0 0 1 0 0 1 1 1 1Check bit #1 Parity 1 1 0 0 1 1 EvenCheck bit #2 Parity 1 1 1 0 1 1 Odd Check bit #4 Parity 0 0 1 0 1 EvenCheck bit #8 Parity 0 1 1 1 1 Even

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 157 ++ x x by the generator

polynomial 13+ x ?

M(x) = 157++ x x  

G(x) = 13 + x  

Since degree of G(x) is r = 3, append 3 zero bits to the lower end of M(x).

Frame: 10100001

Generator: 1001Message after 3 zero bits are appended: 10100001000

Page 2: 434hw3sol

8/3/2019 434hw3sol

http://slidepdf.com/reader/full/434hw3sol 2/5

2

The remainder obtained by dividing x7 + x5 + 1 by the generator polynomial x3 + 1 is

111.

2. (3.19) In protocol 3, is it possible that the sender starts the timer when it is alreadyrunning? 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 thesender is transmitting when the timer is running (and therefore reset), is a repeat/duplicateframe.

(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 andthe receiver.

S1: sender’s lower edgeS2: sender’s upper edgeR1: receiver’s lower edge

R2: receiver’s upper edgeW: window size

There are three main conditions that must hold among the four window edges and thewindow 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

Page 3: 434hw3sol

8/3/2019 434hw3sol

http://slidepdf.com/reader/full/434hw3sol 3/5

3

3.  The receiver’s sequence number must be within the sender’s windowS1 <= 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 communicationchannel? 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 4possible 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. So4X4=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 thebeginning 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 starttransmitting 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 ispassed), 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 ithas 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 Ward’s protocol with permuting virtual station numbers?

Page 4: 434hw3sol

8/3/2019 434hw3sol

http://slidepdf.com/reader/full/434hw3sol 4/5

4

As an example of the worst case scenario with the Mok and Ward protocol, consider 8stations 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  N 2log bits to complete. After each countdown, oneframe will be transmitted. So in total, S will have to wait through N contentioncountdowns and N-1 frame transmissions of length d bits as each other station goes ahead

of S. In total, this takes (N  N 2log ) + (N-1)d bits in the worst case.

5. (4.10) Sixteen stations, numbered 1 through 16, are contending for the use of ashared 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 arecontending for access to the shared channel. Each step will represent a bit slot needed toresolve the contention for each transmitting station.

•  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.

A

C

IH

GE

J

FD

B

K L M N O

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Page 5: 434hw3sol

8/3/2019 434hw3sol

http://slidepdf.com/reader/full/434hw3sol 5/5

5

•  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  n2 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  12 >>n ?

Minimum:

The best case is that the two stations are the first and last station (say 1 and n2 ). 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 themaximum 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 

the two stations is12

1+−in

, and the number of slots to walk the tree is 2(n - i +1) + 1. 

So the mean number of slots to walk the tree is∑=

+−++−

n

i

inin

11

]1)1(2[2