Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer....

30
Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015

Transcript of Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer....

Page 1: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve22 January 2015

Page 2: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

2

Plan for this lecture• At the end of this lecture (and related activities),

students should be able to :

– … apply and compare several data encoding techniques

– … consider design issues to ensure reliable delivery over an unreliable link

– … reason why the data link layer adds control information as an overhead in the transmission

Page 3: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Review

Page 4: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

How well do you think you can compare data encoding techniques?

41 2 3 4

0%

10%

50%

40%

1. Very well!2. Quite well3. Not very well4. Help!

Page 5: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

5

Review data encoding • NRZ

– Data ‘0’: negative voltage – Data ‘1’: positive voltage

• Manchester coding (original convention)

– Data ‘0’: negative voltage changes from low to high– Data ‘1’: positive voltage changes from high to low

• NRZ-I

– Data ‘0’: no transition – Data ‘1’: transition

• 4B/5B

– 4 bits encoded in 5 transition bits

(feedback from questions at the end of

last lecture)

Page 6: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

6

Review data encoding • NRZ

– Data ‘0’: negative voltage – Data ‘1’: positive voltage

• Manchester coding (original convention)

– Data ‘0’: negative voltage changes from low to high– Data ‘1’: positive voltage changes from high to low

• NRZ-I

– Data ‘0’: no transition – Data ‘1’: transition

• 4B/5B

– 4 bits encoded in 5 transition bits

(feedback from questions at the end of

last lecture)

Page 7: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

7

Review data encoding (feedback from questions at the end of

last lecture)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall , 2011

p.275 (T. 4ed) p.146 (T. 5ed)

Page 8: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Talking point

8A. B. C. D. E.

26%

4% 4%7%

59%

Assuming NRZ-I encoding was used for the waveform below, what is the original bit sequence?

A.10001011B.01110100C.11001110D.00110011E.None of the above

Page 9: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Talking point

9A. B. C. D. E.

89%

0% 0%3%9%

Assuming Manchester encoding was used for the waveform below, what is the original bit sequence?

A.11001110B.00110001C.1010010110101001D.0101101001010110E.None of the above

Page 10: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Are you now able to comparedata encoding techniques?

101 2 3 4

40%

4%0%

56%1. Yes, very well!2. Quite well3. Not very well4. Help!

Page 11: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Data Link Layer

Page 12: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

12

Data Link Layer• What is the data link layer for?

What does it offer?What does it require?

p.26-30 (T. 4ed)p.51-55 (T. 5ed)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Page 13: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

13

Services offered by the Data Link Layer• What is the data link layer for?

What does it offer?What does it require?

p.184 -187 (T. 4ed)pp.214-216 (T. 5ed)

Page 14: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

14

Services offered by the Data Link Layer• What is the data link layer for?

What does it offer?What does it require?

– This layer transforms a raw transmission facility into a line “free of errors” to the next layer

– To achieve that, it makes the sender break up the data into sequential frames, which are acknowledged by the receiver

– By doing so, it regulates the flow of data so that slow receivers are not swamped by fast senders

p.184 -187 (T. 4ed)pp.214-216 (T. 5ed)

Page 15: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

15

Services offered by the Data Link Layer• They can vary from protocol to protocol

• There are 3 possibilities:

– Unacknowledged connectionless service

– Acknowledged connectionless service

– Acknowledged connection-oriented service

pp.185-186 (T. 4ed)pp.215-216 (T. 5ed)

Page 16: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

16

Services offered by the Data Link Layer• They can vary from protocol to protocol

• There are 3 possibilities:

– Unacknowledged connectionless service (Appropriate when the error rate is very low, e.g. Ethernet)

– Acknowledged connectionless service (Next step in reliability, e.g. 802.11 (WiFi)

– Acknowledged connection-oriented service (Appropriate over long, unreliable links, e.g. satellite channels or long distance telephone circuit)pp.185-186 (T. 4ed)

pp.215-216 (T. 5ed)

Page 17: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

17

Framing• Breaks up the bit stream (the payload) into discrete

frames and adds control information

• There are 4 methods:

– Byte count

– Flag bytes with byte stuffing

– Flag bits with bit stuffing

– Physical layer coding violations

pp.187-191 (T. 4ed)pp.217-220 (T. 5ed)

Page 18: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

18

Framing• Breaks up the bit stream (the payload) into discrete

frames and adds control information

• There are 4 methods:

– Byte count

– Flag bytes with byte stuffing

– Flag bits with bit stuffing

– Physical layer coding violations (e.g. using “unassigned” codes from the 4B/5B encoding for frame delimiters) p.191 (T. 4ed)

p. 220 (T. 5ed)

Page 19: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

• Frame begins with a count of the number of bytes in it

– Simple, but difficult to resynchronize after an error

Framing – Byte count

19A byte stream. (a) Without errors. (b) With one error.CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall , 2011

pp.188-189 (T. 4ed)pp.217-218 (T. 5ed)

Page 20: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

• Special flag bytes delimit frames; occurrences of flags in the data must be stuffed (escaped)

– Longer, but easy to resynchronize after error

Framing – Byte stuffing

20

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall , 2011

pp.188-189 (T. 4ed)pp.217-218 (T. 5ed)

Page 21: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

• Special flag bytes delimit frames; occurrences of flags in the data must be stuffed (escaped)

– Longer, but easy to resynchronize after error

Framing – Byte stuffing

21

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall , 2011

pp.188-189 (T. 4ed)pp.217-218 (T. 5ed)

(a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after byte stuffing.

Page 22: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

• Stuffing is done at the bit level:

– Frame flag has six consecutive 1s (not shown)

– On transmit, after five 1s in the data, a 0 is stuffedOn receive, a 0 after five 1s is deleted

• Side effect (as in byte stuffing) is that the size of the frame depends on the data being sent!

Framing – Bit stuffing

22

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall , 2011

pp.188-189 (T. 4ed)pp.217-218 (T. 5ed)

Transmitted bitswith stuffing

Data bits

Page 23: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

Standards: A case study

“The nice thing about standards is that you have so many to choose from.

Furthermore, if you do not like any of them, you can just wait for next year's model”

Andrew S. Tanenbaum

pp.235 (T. 4ed)

Page 24: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

24

Case Study: HDLC• High-Level Data Link Control

– Precursor of the PPP- Point-to-Point Protocol

– Originally an IBM protocol: SDLC (Synchronous Data Link Control)

– Consider the frame overhead and the efficiency in the HDLC

pp.234-237 HDLC / pp.238-242 PPP (T.4e)pp.219 HDLC / pp.266-267 PPP (T.5e)

Page 25: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

25

HDLC Frames• Every frame is delimited at the start and end by the

sequence 0x7E (01111110), the “flag byte”

(N.B. both sequences are part of the frame)

Variable length

8 8 8 … 16/32 8

Page 26: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

26

The payload• The “Data” field is the “payload”

– i.e. the information we intend to communicate to the other end of the point-to-point link

• All other information is discarded at the receiver

Variable length

8 8 8 … 16/32 8

Page 27: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

27

Talking point• What if the flag byte occurs within the payload?

pp.190 (T. 4ed)pp.219 (T. 5ed)

Page 28: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

28

(Bit stuffing!)• If the flag byte occurs within the payload:

– When there are 5 consecutive “1” bits in the data, a “0” is stuffed automatically

– When the receiver sees 5 consecutive incoming “1” bits :

• If followed by “0”, this is removed (it was data)

• If followed by “1”, this must be a flag byte!

pp.190 (T. 4ed)pp.219 (T. 5ed)

Page 29: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

29

Talking point: What size for N?• Let's calculate the efficiency of the transmission in

the following cases:

– Sending one character per frame (N=8bits)

– Sending a KB per frame (N=1024bytes)

Variable length

(N)

8 8 8 … 16 8

Page 30: Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.

30

Checking Learning Outcomes• At the end of this lecture (and related activities),

students should be able to :

– … apply and compare several data encoding techniques

– … consider design issues to ensure reliable delivery over an unreliable link

– … reason why the data link layer adds control information as an overhead in the transmission