layer 2: division into two parts llc: frame construction

13
Logical Link Control (LLC) (Layer 2b) Organization of the data to be sent into frames Guarantee (if possible) an error free transmission between neighboring nodes through: Detection (and recovery) of transfer errors Flow Control (avoidance of overloading the receiver) Buffer Management Medium Access Control (MAC) (Layer 2a) Control of the access to the communication channel in broadcast networks Sicherungs- ebene ISO/OSI 802.3 CSMA/CD (Ethernet) 802.4 Token Bus 802.5 Token Ring 802.6 DQDB ANSI FDDI ATM ATM LAN Emulation ... Forum IEEE 802.2 Logical Link Control X3T9.5 ... Layer 2: Division into two Parts Existing Networks MAC (Medium Access Control) Data Link Layer LLC (Physical) mark the frame by: • Start and end flags • Start flag and length • Code injuries Organization of a message into uniform units (for simpler transmission) Well-defined interface to the upper layer (layer 3) Marking of the units: Header Trailer Data Control information (addresses, frame numbers,…) Error check (checking sequence for the frame) Next task of the LLC layer: protected transmission of the frames to the communication partner. The transmission over layer 1 is not necessarily free of errors! Question: how can errors be recognized and repaired? FCS = Frame Checking Sequence LLC: Frame Construction Error-detecting and -correcting Codes From the data, compute a short checksum and send it together with the data to the receiver. The receiver also computes a checksum from the received data and compares it with those of the sender. Simplest procedure - parity bit: count the number of 1s: Sender: 10111001 PB: 1 sended: 101110011 Receiver: 001011011 PB computed: 0 Variant: double parity Improvement of the parity bit procedure by further parity bits. For this, several blocks of bits are grouped and treated together: Sender: 1011 1 Receiver: 1011 1 0010 1 0110 0 1100 0 1100 0 0110 0 0110 0 0011 0111 An incorrect bit can be identified and corrected by this procedure. 1-Bit errors are detected 2-Bit errors are not detected Corrections are not possible! Error-correcting Codes Error correction Error correction generally means: Transmission of redundancies: • Length of the transmission: n bit (2 n possible binary sequences) • Message length: m (<n) bit (2 m permissible code words) k parity bits (k = n - m) Form a “sphere” of code words around each message Hamming Distance D: Number of places, in which two binary sequences differ • Then: D 2t + 1 code is t-error-correcting D t + 1 code is t-error-detecting That means: for error-correction, a relatively large overhead has to be transmitted – and it is not guaranteed, that the identified correction really is the right one.

Upload: others

Post on 23-Jul-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 1Chapter 2.2: Data Link Layer

• Logical Link Control (LLC) (Layer 2b)

→ Organization of the data to be sent into frames→ Guarantee (if possible) an error free transmission between neighboring

nodes through:→ Detection (and recovery) of transfer errors→ Flow Control (avoidance of overloading the receiver)→ Buffer Management

• Medium Access Control (MAC) (Layer 2a)

→ Control of the access to the communication channel in broadcast networks

Sic

heru

ngs-

eben

e

LLC

MAC

ISO/OSI

802.3

CSMA/CD(Ethernet)

802.4

TokenBus

802.5

TokenRing

802.6

DQDB

ANSI

FDDI

ATM

ATM LANEmulation

...Forum

IEEE 802.2 Logical Link Control

X3T9.5

Reale Netze

...

Layer 2: Division into two Parts

Existing Networks

MAC(Medium

Access Control)

Dat

a L

ink

Lay

er

LLC

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 2Chapter 2.2: Data Link Layer

(Physical) markthe frame by:

• Start and end flags

• Start flag and length

• Code injuries

• Organization of a message into uniform units (for simpler transmission)

• Well-defined interface to the upper layer (layer 3)

• Marking of the units:

Header TrailerData

Control information (addresses, frame numbers,…)

Error check(checking sequence for the frame)

Next task of the LLC layer: protected transmission of the frames to the communication partner.

The transmission over layer 1 is not necessarily free of errors!

Question: how can errors be recognized and repaired?

FCS = Frame Checking Sequence

LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 3Chapter 2.2: Data Link Layer

Error-detecting and -correcting Codes

From the data, compute a short checksum and send it together with the data to the receiver. The receiver also computes a checksum from the received data and compares it with those of the sender.

Simplest procedure - parity bit: count the number of 1s:Sender: 10111001 PB: 1 sended: 101110011Receiver: 001011011 PB computed: 0

Variant: double parityImprovement of the parity bit procedure by further parity bits. For this, several blocks of bits are grouped and treated together:

Sender: 1011 1 Receiver: 1011 10010 1 0110 01100 0 1100 00110 0 0110 00011 0111

An incorrect bit can be identified and corrected by this procedure.

1-Bit errors are detected

2-Bit errors are not detected

Corrections are not possible!

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 4Chapter 2.2: Data Link Layer

Error-correcting Codes

Error correctionError correction generally means: Transmission of redundancies:

• Length of the transmission: n bit (2n possible binary sequences)

• Message length: m (<n) bit (2m permissible code words)• k parity bits (k = n - m)

• Form a “sphere” of code words around each message

• Hamming Distance D:

Number of places, in which two binary sequences differ

• Then: D ≥ 2t + 1 ⇒ code is t-error-correctingD ≥ t + 1 ⇒ code is t-error-detecting

That means: for error-correction, a relatively large overhead has to be transmitted – and it is not guaranteed, that the identified correction really is the right one.

Page 2: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 5Chapter 2.2: Data Link Layer

Goal: Use of several parity bits, each of them considering several bits (overlapping). Errors can be identified and corrected by combining the parity bits.The Hamming code is the “minimal” code of this category.

Idea: Representation of each natural number by sum of powers to two.

In a code word

w = z1,…, zn

the parity bits are placed exactly at the k positions, for them the index is a power of two. At the remaining m = n - k positions the data bits are placed.

Each of the k additional bits is a parity bit for all places, for which the representation in powers of two contains the position of the additional bit.

Hamming Code

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 6Chapter 2.2: Data Link Layer

Parity bit 1: Data bit 3, 5, 7, 9, 11 3 = 1 + 2

Parity bit 2: Data bit 3, 6, 7, 10, 11 5 = 1 + 4

Parity bit 4: Data bit 5, 6, 7 6 = 2 + 4

Parity bit 8: Data bit 9, 10, 11 7 = 1 + 2 + 4

9 = 1 + 8

10 = 2 + 8

11 = 1 + 2 + 8Problem with Hamming code: errors involving several following bits are usually wrongly corrected

Receiver:

• examine parity bits

• if necessary, sum up indices of the incorrect parity bits

→ index of the incorrect bit

1-bit errors can definitely be identified and corrected

Hamming Code

H 1001000

A 1100001

M 1101101

M 1101101

I 1101001

N 1101110

G 1100111

1 2 3 4 5 6 7 8 9 10 11

0 0 1 1 0 0 1 0 0 0 0

1 0 1 1 1 0 0 1 0 0 1

1 1 1 0 1 0 1 0 1 0 1

1 1 1 0 1 0 1 0 1 0 1

ASCII-Code Codeword

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 7Chapter 2.2: Data Link Layer

Weaknesses: • 2-bit errors are not corrected (or wrongly corrected!)

• 3-bit errors are not recognized

• …

Hamming code

00110010000Transmission

error 00110000000

11100000000

Receiver computes paritybits:

a) Bit 4 and bit 11 inverted:→ parity bits 1, 2, 4, 8 are wrong→ bit 15 is to be corrected, but

does not exist

b) Bit 2 and bit 4 inverted→ parity bits 2, 4 wrong→ bit 6 is falsely recognized as

incorrect

c) Bits 1, 8, 9 inverted→ all parity bits are correct→ no error is recognized

Summing up the indizes 1, 2 and 4, bit 7 is detected as false

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 8Chapter 2.2: Data Link Layer

Error Detection with Cyclic Codes

Problem: how to recognize errors in several bits, especially sequences of bit errors?

The use of simple parity bits is not suitable. However, in data communication (modem, telephone cables) such errors arise frequently.

Most often used: Polynomial Codes

Idea: a k-bit PDU (ak-1, …, a0) is seen as a polynomial ak-1xk-1 + … + a0 with the coefficients “0” and “1”.

Example: 1100101 is seen as x6 ...... x1x0 = x6 + x5 + x2 + 1

For computations, polynomial arithmetic modulo 2 is used, i.e. addition and subtraction without carriage. Both operations become Exclusive-OR operations.

Page 3: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 9Chapter 2.2: Data Link Layer

Idea for error detection:

• Sender and receiver agree upon a generator polynomial G(x) = xr + … + x0. The first and the last coefficient have to be 1.

• The sender interprets a data block of length m as polynomial M(x).

• The sender extends M(x), i.e. adds “redundant” bits in a way that the extended polynomial M’(x) is divisible by G(x).(Redundancy = remainder R(x) by division of the sequence with G(x))

• The receiver divides the received extended M(x) by G(x). If the remainder is 0, there was no error, otherwise some error occurred.

Name: Cyclic Redundancy Checksum (CRC)

Error Detection with Cyclic Codes

Note: also the parity bit can be seen as CRC, with generator polynomial x + 1!

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 10Chapter 2.2: Data Link Layer

CRC - Example

Data to be transmitted: 10111001Generator polynomial: x4 + x +1

101110010000 : 10011 = 1010011110011

1000010011

1110010011

11110100111101010011

1001 = x3 + 1 = R(x)

Sender:

CRC = 1001, sending 101110011001

101110011001 : 10011 = 1010011110011

1000010011

1111010011

11010100111001110011

0

Receiver:

Data received correctly

Note: usually, the „extra“ positions arepreset with zeros – but on somereason e.g. Ethernet uses the invertedbits as presets.

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 11Chapter 2.2: Data Link Layer

Computation of CRC: Shift Registers

R R R R⊕ ⊕ ⊕ ⊕ ⊕ R

1 1 10 0

Implementation by Shift Registers:• XOR for substraction

• AND for applying substraction: • first register = 0: no substraction• first register = 1: substraction

When no more input is given in the leftmost register, the other registers containthe CRC result.

Generator polynomial x4 + x +1:

Simplified realization: R R R R⊕ ⊕ R

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 12Chapter 2.2: Data Link Layer

Shift Registers - Example

Data to be transmitted: 10111001

Generator polynomial: x4 + x +1

0 0 0 ⊕ 0 ⊕ 0 101110010000

Sent data

0 0 0 ⊕ 0 ⊕ 1 01110010000

Sent data 001

0 0 0 ⊕ 1 ⊕ 0 1110010000

Sent data 0010

Page 4: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 13Chapter 2.2: Data Link Layer

Shift Registers - Example

0 0 1 ⊕ 0 ⊕ 1 110010000

Sent data 00101

0 1 0 ⊕ 1 ⊕ 1 10010000

Sent data 001011

1 0 1 ⊕ 1 ⊕ 1 0010000

Sent data 1110111

0 1 0 ⊕ 0 ⊕ 0 010000

Sent data 00101110

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 14Chapter 2.2: Data Link Layer

Shift Registers - Example

1 0 0 ⊕ 0 ⊕ 0 10000

Sent data 111011100

0 0 1 ⊕ 1 ⊕ 1 0000

Sent data 0010111001

0 1 1 ⊕ 1 ⊕ 0 000

Sent data 0010111001

1 1 1 ⊕ 0 ⊕ 0 00

Sent data 1110111001

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 15Chapter 2.2: Data Link Layer

Shift Registers - Example

1 1 1 ⊕ 1 ⊕ 0 0

Sent data 1110111001

1 1 0 ⊕ 1 ⊕ 0

Sent data 1110111001

1 0 0 ⊕ 1 ⊕ x

Sent data 11101110011

x 0 0 ⊕ 1 ⊕ x

Sent data 001011100110

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 16Chapter 2.2: Data Link Layer

Shift Registers - Example

x x 0 ⊕ 1 ⊕ x

Sent data 0010111001100

x x x ⊕ 1 ⊕ x

Sent data 00101110011001

x x x ⊕ x ⊕ x

Sent data 00101110011001

Page 5: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 17Chapter 2.2: Data Link Layer

CRC is not perfect

001010010001 : 10011 = 0010111010011

11110100111101010011

1001010011

11

Receiver:

Error detected

001110110001 : 10011 = 00111111100111110110011

11100100111111010011

11010100111001110011

0

Receiver:

Error not detected

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 18Chapter 2.2: Data Link Layer

Common 16-bit generator polynomials:

• CRC-16: G(x) = x16 + x15 + x2 +1• CRC CCITT: G(x) = x16 + x12 + x5 +1• Ethernet: G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11

+ x10 + x8 + x7 + x5 + x4 + x2 + x + 1

Error detection (for 16-bit generator polynomials):

• all single bit errors• all double bit errors• all three-bit errors

• all error samples with odd number of bit errors• all error bursts with 16 or fewer bits

• 99.997% of all 17-bit error bursts

• 99.998% of all error bursts with length ≥ 18 bits• Remaining error rate < 0.5 * 10-5 block error rate (original)

CRC: Characteristics

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 19Chapter 2.2: Data Link Layer

Header / DataFCS

CRC is not perfect

1.) There are still remaining some error-combinations which can occur undetected – the probability is very small, but in principle it is possible

2.) Assume, the receiver only gets part of the original message:

The receiver interprets the end of the message as FCS and tries to check the rest of the received bits as sent data.

• Probability for “assumed FCS” = “FCS for assumed data”:

1/2r for r-bit FCS, because each of the r bits is correct with probability ½.This problem can be eliminated by using a fixed byte structure for the data frame or a length field in the header.

3.) An error could consist of adding a multiple of G(x) to M‘(x)

Header / Data

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 20Chapter 2.2: Data Link Layer

In exceptional cases even errors are correctable by CRCs.Example: ATM (Asynchronous Transfer Mode)

• Data units have fixed length

• 5 byte header + 48 byte data• The last header byte is a checksum for the header

• Generator polynomial G(x) = x8 + x2 + x +1

⇒ It is even possible to correct a 1-bit error, due to:there are 40 possible 1-bit errorsand those lead on 40 different non-zero remainders.

Correction is not assigned with e.g. Ethernet: an Ethernet frame has a length

between 64 and 1512 byte.

CRC: Error Correction

Page 6: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 21Chapter 2.2: Data Link Layer

Error detection: ARQ (Automatic Repeat Request)• Use of error-detecting codes (CRC)• Errors are detected, but cannot be corrected. Therefore, falsified data

must be requested again. • Introduction of flow control:

� number the data blocks to be sent

� acknowledgement of blocks by the receiver� incorrectly transferred blocks are repeated

• Suitable for transmissions which do not tolerate errors (files).

Error correction: FEC (Forward Error Correction)• Use of error-correcting codes• Falsified data in most cases can be corrected. Uncorrectable data are

simply dismissed.• Feedback from the receiver to the sender is not necessary.• Suitable for transmissions tolerating no transmission delays (video,

audio) as well as for coding resp. protecting data on CDs or DVDs.

Error Protection Mechanisms

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 22Chapter 2.2: Data Link Layer

Transmitter

Receiver

1

1

2

F

2

2

3

3

ACK

ACK

time

out

Simple procedure: The sender sends a data block and waits, until an acknowledgement of the receiver arrives or a timeout is reached.

Incorrect blocks are repeated, otherwise the next block is sent.

Disadvantage: large waiting periods between the transmission of single blocks. Thus much transmission capacity is wasted.

ACK: Acknowledgment, i.e. ‘everything ok’

Waiting period

Flow Control: Send and Wait

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 23Chapter 2.2: Data Link Layer

Introduction of a transmission window• Common procedure to avoid long waiting periods of the sender• Sender and receiver agree upon a transmission window. If W is the window size, it

means: the sender may send maximally W messages without an acknowledgement of the receiver.

• The messages are sequentially numbered in the frame header (0, 1, 2,…, MODULUS-1, 0,…; whereby W < MODULUS).

• The sender may send sequentially numbered messages up to W,without getting an acknowledgement for the first frame.

• The receiver confirms by acknowledgements (ACK).• The sender moves the window as soon as an ACK arrives.

Flow control: Sliding Window

Advantages of the procedure:

• The sender can take advantage of the network capacity• A sender who is too fast for the receiver is slowed down (the receiver only can

read data from the network slowly, thus it rarely sends ACKs)

• Sending and receiving speed are adapted

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 24Chapter 2.2: Data Link Layer

Sliding Window

Example (for 3-bit sequence/acknowledgement number)• with 3 bits for sequence/acknowledgement number, m = 8 possible combinations

• Stations agree upon a window size W with 1 ≤ W < m, e.g. W = 7• The window limits the number of unconfirmed frames allowed at one time

(here max. 7, because of W = 7)• With receipt of an acknowledgement, the window is shifted accordingly

• Frames are numbered sequentially modulo m (for m = 8 thus numbers from 0 to 7)

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2

Time

ACK 0 ACK 2 ACK 601

234

5

67

Station sendetFrames 0 - 6

01

234

5

67

Station erhältQuittung 0

01

234

5

67

Station verschiebtFenster um 1,

01

234

5

67

Station erhältQuittung 1, 2

01

234

5

67

Station verschiebtFenster um 2,

sendet Frame 7 sendet Frame 0, 1

Station sends frames 0 - 6

Station receives acknowledgement 0

Station slides window by 1 and sends

frame 7

Station receives acknowledgement

1,2

Station slides window by 2 and sends frames 0,1

Page 7: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 25Chapter 2.2: Data Link Layer

There is a reason why window size W has to be smaller than MODULUS:• Sequence numbers e.g. have 3 bits: 23 = 8 sequence numbers (0, …, 7)

• I.e. MODULUS = 8

• Assume the window size to be W = 8. A sends frames to B.

• B last acknowledged frame 2 (ACK 3 was sent to A)

B has acknowledged 0 1 2

• A sends 8 frames, without receiving an acknowledgement of B

A sent 0 1 2 3 4 5 6 7 0 1 2

• It arrives an acknowledgement ACK 3.

Case 1: B only has received 0 1 2

Case 2: B has received 0 1 2 3 4 5 6 7 0 1 2

• A does not know whether case 1 or 2 holds for B: the acknowledgement is not clear!⇒ W ≤ 7 (W < MODULUS in general)

Maximum Window Size with Sliding Window

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 26Chapter 2.2: Data Link Layer

The sender sends data blocks continuously (within the transmission window). The receiver answers:

• ACKj: everything up to block j is correct

• REJj/NACKj: up to block j-1 everything is correct, block j is incorrect

• Go-back-n: with a REJj, starting from block j everything is transferred again

Disadvantage: With a REJj the transmitter must repeat all blocks starting from j

Advantage: the receiver needs only one buffer place

Example of W = 5; MODULUS = 8

0 1 2 3 4 5 2 3 4 5 6Source

DestinationREJ2ACK0 ACK2

Elimination of Errors: Go-back-n

ACK1

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 27Chapter 2.2: Data Link Layer

Extensions

• Only positive acknowledgements are given• When a PDU is missing, the receiver buffers the following (correct) PDUs• If the sender gets no acknowledgement for a PDU, a timeout occurs and the

sender repeats (like in go-back-n) everything beginning with the missing PDU• When the missing PDU arrives, an acknowledgement for the subsequently

received PDUs is sent• When the sender gets this acknowledgement, it stops repeating old PDUs and

goes on with new PDUs• Thus, the capacity is used more efficiently, but the receiver needs more buffer

Selective Repeat SREPEAT:

Selective Reject SREJj

• Like in SREPEAT, correctly received PDUs after a missing PDU are buffered• The receiver gives a negative acknowledgement for the missing PDU j• The sender repeats only PDU j. By this, no unnecessary duplicates are sent,

the efficiency of capacity usage again is enhanced.• Variant: the receiver can send a list of missing PDUs to the sender, not only

single negative acknowledgements• But: again the receiver needs more buffer.

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 28Chapter 2.2: Data Link Layer

First: Definition of some data types (protocol.h):

Implementation of Protocols

Example of use: Implementation of a protocol for layer 2

Page 8: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 29Chapter 2.2: Data Link Layer

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 30Chapter 2.2: Data Link Layer

Step 1: Send without restrictions

• No transmission errors

• No flow control

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 31Chapter 2.2: Data Link Layer

Step 2: Simple flow control

• No transmission errors

• Send-and-Wait as flow control

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 32Chapter 2.2: Data Link Layer

Step 3: Error handling and flow control - sender

Page 9: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 33Chapter 2.2: Data Link Layer

Step 3: Error handling and flow control -receiver

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 34Chapter 2.2: Data Link Layer

Frame identification:mark the beginning and end with a flag:“01111110”

→ Flag may never occur within a frame

→ Used for this purpose: Bitstuffing

Sender inserts a zero after each sequence of five ones.The receiver removes this zero.

Sender: 11111111

111110111

Receiver: 111110111

11111111

High Level Data Link Control (HDLC)

Protocol for layer 2: HDLC

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 35Chapter 2.2: Data Link Layer

HDLC Frame

N(R)

01111110 01111110Address Control FCSDATA

8 168 8 (16) 8≥0

• In the idle state, only “1”s are sent. The receiver recognizes a transmission with the first “0”.

• “Address” contains an identifier to inform the receiver about what to do, e.g. “00000110” means “IP protocol used for processing the data”.

• The checksum is computed by using a CRC.• Since CRC conducts no error correction, flow control is necessary. “Control”

contains the sequence number N(S) for the message; at the same time, in the opposite direction a message can be acknowledged using the acknowledgement number N(R) (“Piggybacking”).

BitsHeader TrailerData

FlagFlag

N(S)For synchronization

on layer 1 P/FD/CD/C: DATA (0) resp. control (1)P/F: Poll/final for the co-ordination of several senders

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 36Chapter 2.2: Data Link Layer

I-Rahmen

S-Rahmen

U-Rahmen

PFS S N(R)

PFN(S) N(R)

PFM M M M M1 1

1 0

0 Information

Supervisory

Unnumbered

Sequence number Acknowledgement number

N(S) Sequence Number

N(R) Acknowledgement Number (Frame N(R) is expected next – all frames up to N(R)-1 are acknowledged, counted modulo the maximum sequence number plus 1.)

Frame Types for HDLC

I-Frame

S-Frame

U-Frame

⇒ with 3 bit for N(S) and N(R), only a window size of 7 is possible;⇒ long signal transmission time, low data transmission ratesSolution: Extended numbering mode with additional control byte (2 * 4 bits)⇒ 7 bits per direction, window size W ≤ 127

Page 10: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 37Chapter 2.2: Data Link Layer

Temporarily not ready to receive, acknowledge up to N(R) -1 in the other direction

NACK for N(R), ACK up to N(R)-1. The sender should repeat everything beginning with N(R)

ACK up to N(R)-1, selective NACK for N(R)

Connection Establishment

General ACK (e.g. for connection establishment)

Frame/command not valid (invalid frame, wrong sequence number, …)

Send frame N(S), ACK up to N(R) -1 in the other direction

Ready to receive, ACK up to N(R) -1 in the other direction

Announcement of connection termination

Connection Termination

Frame Types for HDLC

0 0 0F1 1 1 1DM

(Disconnect Mode)

0 0 1F1 1 1 0FRMR

(Frame Reject)

0 0 1F1 1 1 0CMDR

(Command Reject)

1 1 0F1 1 0 0UA

(Unnumbered ACK)

0 1 0P1 1 0 0DISC

(Disconnect)

1 0 0 P1 1 1 1SABM

(Set Asynchronous Balanced Mode)

U

N(R)P/F1 0 1 1

SREJ(Selective Reject)

N(R)P/F1 0 0 1

REJ(Reject)

1 0 1 0

1 0 0 0

0

Fields1 2 3 4 5 6 7 8

N(S)

P/F

P/F

P

N(R)RNR

(Receive not Ready)

N(R)RR

(Receive Ready)

S

N(R)I

(Data Frame)I

NameType

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 38Chapter 2.2: Data Link Layer

PPP – Point-to-Point Protocol

Often used: point-to-point connections between network nodes

Variant of HDLC for point-to-point connections: PPP

The structure of frames is oriented at HDLC:

• Flag: same as for HDLC

• Address: unnecessary, therefore set to 11111111

• Control: unnumbered mode (marked by 00000011) without sequence numbers and acknowledgments as default procedure

• Protocol: specifies contents of the data part (Payload)

• Checksum: 2 byte error detection is usually used

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 39Chapter 2.2: Data Link Layer

Controlling the competitive access of several usersto a shared medium

Simplest procedures: firm assignment of a limited capacity

• Time Division Multiple Access (TDMA)

• Frequency Division Multiple Access (FDMA)

1 1 1 12 2 23 3 3 3 3 3

Each user gets the entire transmission capacity for fixed time intervals(Baseband transmission)

Each user gets a fixed portion of the transmission capacity (a frequency range) for the whole time (Broadband transmission)

User 1User 2User 3

Time

Frequency

Time

Frequency

Medium Access Control (MAC)

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 40Chapter 2.2: Data Link Layer

Communication follows a two-phase schema (alternating phases):

• In the reservation phase the sender makes a reservation by indicating the wish to send data (or even the length of the data to be sent)

• In the transmission phase the data communication takes place (after successful reservation)

• Advantage: very efficient use of the capacity• Disadvantage: Delay by two-phase procedure; further, often a master station is

needed, which cyclically queries all other stations whether they have to send data. This master station assigns sending rights.

MAC - Reservation Protocols

Techniques for „easy“ reservation without master station:

• Explicit reservation• Implicit reservation

Page 11: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 41Chapter 2.2: Data Link Layer

Explicit Reservation

Variant 1: without contention• Only suitable for small number of users• Each user i is assigned the i-th slot in the reservation frame. If it wants to send data,

it sets the i-th bit in the reservation frame to 1.• After the reservation phase, all stations having set their reservation bit can send

their data in the order of their bits in the reservation frame.

• Uses two frame types:

� reservation frame (very small) in the first phase�data frame (constant length) in the second phase

1 11

reservationframe

2 5 7

data frames of stations having reserved

1 4 111 1

This procedure is called Bitmap Protocol

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 42Chapter 2.2: Data Link Layer

Explicit Reservation

Variant 2: with contention• For higher number of users• The reservation frame consists of a limited number of contention slots (smaller than

the number of participating stations)• Users try to get a contention slot (and by that make a reservation for a data slot) by

random choice, writing their station number into a slot

• If there is no collision in the reservation phase, a station may send.

• Uses two frame types:

� reservation frame (very small) in the first phase�data frame (constant length) in the second phase

17 445

reservation frame with contention slots

17 45 4

data frames of stations having reserved

11 11 25 12

22 31 22 345 31

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 43Chapter 2.2: Data Link Layer

Implicit Reservation

• No reservation slots, only data slots of certain length.

• A window consists of N data slots, windows a cyclically repeated• The duration of the window must be longer than the round-trip time

Procedure:• A station which wants to send observes N slots without doing anything and

marks the slots as follows:

�0, if the slot if empty or collided�1, if the slot is used by somebody else

• In the following window the station randomly chooses one of the slots marked with 0 (Simplification: choose the first slot marked with „0“)

• Two cases:

�conflict: try again�successful transmission: slot reserved for the station as long as it sends data.

If the station is not using its slot in one window, the reservation is dismissed.

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 44Chapter 2.2: Data Link Layer

Implicit Reservation

Window 2

Window 3

Window 4

Window 5

Window 6

1 2 3 4 5 6 7 8Slots:

ACDABA-F

AC-ABA--

A---BAF-

A---BAFD

Reservation

A C D A B A B/D F

A C A B A

A B/F B A F

A B A F D

A C E E B A F D t

Window 1

Example: 8 data slots, Stations A - F

Stations observing 8 slots

Collision within slot 7; the other slots are reserved

Page 12: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 45Chapter 2.2: Data Link Layer

Best known protocol has the name ALOHA• Developed on the Hawaiian islands: stations are connected by satellite• Very simple principle, no coordination:

• Stations are sending completely uncoordinated, all using the same frequencies

• When two (or more) stations are sending at the same time, a collision occurs: both messages are destroyed. Problem: collisions occur even with very small overlaps!

→ Vulnerability period: 2 times the length of a frame• When a collision occurs, frames are repeated after a random time• Problem: since traffic runs over a satellite, a sender only hears after very long

time, whether the transmission was successful or not.

MAC – Decentralized Protocols

Sender A

Sender B

Sender C

Collision

t

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 46Chapter 2.2: Data Link Layer

Improvement: Slotted ALOHA• The whole time axis is divided into time slots (similar to TDMA, but time slots

are not firmly assigned to stations)• The transmission of a block starts at the beginning of a time slot

→ fewer collisions, vulnerability period of one frame length

• But: the stations must be synchronized!

Problem with ALOHA: even small laps already lead to transmission conflicts. Therefore often collisions arise, causing many repetitions:

� No guaranteed response times � Low throughput

MAC – Decentralized Protocols

Sender A

Sender B

Sender C

Collision

t

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 47Chapter 2.2: Data Link Layer

How to estimate the Efficiency of ALOHA?

thinkingusers

commonchannel

backloggedusers

no conflict

conflicttotal traffic G

• G: average number of frames per time unit

• S: throughput, i.e. rate of successful transmissions

Relation between G and S?

Depends significantly on the traffic structure.

• Model A: only one sender.

No collisions, so S = G is possible• Model B: many users, each of

them inactive most time

→ new arrivals are totally random

Which possible states do we have in ALOHA?

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 48Chapter 2.2: Data Link Layer

Randomness

Suppose that the total traffic is absolutely random.

What is the biggest randomness possible?arrival

Random arrivals:

• consider time interval of length h. Observe arrivals in that interval.

• Arrivals have a certain intensity G(average rate per time unit)

• „Randomness“: probability of an arrival in a (small) time interval h is proportional �… to the intensity G

�… to h� ... to G·h

• For very small h, only 0 or 1 arrivals are possible:�Prob(exactly one arrival within interval length h) = G·h + o(h)

�Prob(no arrivals within interval length h) = 1 – G·h + o(h)

o(h): „disturbance function“ with

t

h

0)( →

h

hofor h → 0

Page 13: Layer 2: Division into two Parts LLC: Frame Construction

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 49Chapter 2.2: Data Link Layer

Use for ALOHA

These conditions/requirements lead to the Poisson distribution.• Consider the total number i of events in an interval of length T

→ Prob(exactly i arrivals in [0;T]) =

Back to ALOHA: relation between S and GSuppose that G follows the poisson distribution, i.e. G is totally random.

S = G·Prob(no collision occurs)= G·Prob(nobody else started in my vulnerability period)

=G·Prob(no arrival in interval of length T = 2) for pure ALOHA

G·Prob(no arrival in interval of length T = 1) for slotted ALOHA

Prob(0 arrivals in [0;T]) = e-G·T

=G·e-2G for pure ALOHA

G·e-G for slotted ALOHA

Note: randomness (i.e. Poisson) is not valid for high traffic and if waiting time after retransmission is short

TGi

ei

TG ⋅−⋅⋅!

)(

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 50Chapter 2.2: Data Link Layer

Throughput vs. Offered Traffic

Analytical computation:

• Both, Pure ALOHA and Slotted ALOHA cannot achieve a high throughput• But: simple principle, no coordination necessary between the stations

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 51Chapter 2.2: Data Link Layer

MAC – Decentralized Protocols

• Variant of ALOHA for networks with small range exists

• Similar to ALOHA: no coordination of the stations

• But: each station which wants to send first examines whether already another station is sending

• If no sending takes place, the station begins to send. (Carrier Sense Multiple Access, CSMA)

• Notice: this principle only works within networks having a short transmission delay – using the principle within satellite systems is not possible because there would be no chance to know whether a conflict occurred before end of the transmission

• Advantages: simple, because no master station and no tokens are needed; nevertheless good utilization of the network capacity

• Disadvantage: no guaranteed medium access, a large delay up to beginning a transmission is possible

Lehrstuhl für Informatik 4

Kommunikation und verteilte Systeme

Page 52Chapter 2.2: Data Link Layer

Introduction of a token (determined bit sequence)

• Only the holder of the token is allowed to send

• Token is cyclically passed on between all stations

→ particularly suitable for ring topologies

→ Token Ring (4/16/100 Mbit/s)

Characteristics:

• Guaranteed accesses, no collisions

• Very good utilization of the network capacity, high efficiency

• Fair, guaranteed response times

• Possible: multiple tokens

• But: complex and expensive

Passing on of the token

MAC – Coordination by using a Token