Title: The Link Layer
1The Link Layer
- Has 2 main Components
- The Data Link Layer
- Medium Access Control (MAC)
- ExamplesSLIP, PPP, Ethernet.
2Logical Link Layer Function
- Provides service to the network layer
- Has two Components
- Data link layer
- Framing
- Error Handling
- Flow control
- Medium access control
- In the case of a shared medium, this function
provides means for sharing optimally the medium
3Framing
- What is it? breaking up the bits into discrete
frames and checking the total number of received
bits (the checksum) - Why? to ensure that the number and the value of
the sent and the received bits are exact - How? character count, Start/Stop characters,
Start/stop flags
4Character Count
Character count
Character count
Character count
5 1 2 3 4 5 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
Frame 1 with 5 char
Frame 4 with 8 char
The problem with this method is
New Character counts
Transmission Error
5 1 2 3 4 7 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
Frame 1 with 5 char
5Start/Stop characters
Stuffed DLE
A
DLE
B
A
DLE
DLE
B
STX
DLE
ETX
DLE
A
DLE
B
- STX is Start of TeXt
- DLE is Data Link Escape
- ETX End of TeXt
6Start/stop flags
7Error Handling
- What is it? A mechanism to make sure all frames
are delivered to the right destination and in the
right order and only once - Why? The sent data may be corrupted or vanish in
the network - How? Give feedback to the source machine by
acknowledging the reception and using temporal
flags (i.e. a timer) Then after correcting the
errors
8Error Handling
- Error detection
- Parity bit
- 2D/Crossed parity
- Hamming code
- Error correction
- Hamming Code
9Parity bit
- The sender adds a parity bit to the end of the
word such that the total number of bits
(including the parity bit) is even (Even parity) - 01110110 becomes 011101101
- Detects only odd number of corrupted bits Why?
102D/Crossed Parity
11Hamming code (Detecting Correcting)
- Hamming distance of two WORDS is the number of
bits that differ (exclusive OR between the 2
words) - Example 10001001 and 10110001, the Hamming
distance is 3 - The Hamming distance of a list of codewords is
the smallest distance between any pair of
codewords on this list
12Hamming code (Detecting Correcting)
- Assume the following list of valid codewords
- 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 1 1 1 1 1
- 1 1 1 1 1 0 0 0 0 0
- 1 1 1 1 1 1 1 1 1 1
- What is the hamming distance of this list?
- It is 5 since the smallest distance between any
two codewords of this list is 5
13How can we use hamming codes in errors
detection/correction
- Codeword Data Checkbits
- N bits M bits R bits
- Given the structure codewords, we can build a
complete list of valid codewords - A Hamming distance of d will allow to detect up
to (n-1) corrupted bits Why? - A Hamming distance of d will allow to correct up
to (n/2) or ((n-1)/2) corrupted bits Why?
14Hamming code (Detecting Correcting)
- Hence
- we need a distance of d1 to detect d errors
- we need a distance of 2d1 to correct d errors
- A hamming distance of 5bits can
- detect errors of 4bits
- correct errors of 2bits
- See the example in page 185
- Generally, Checkbits bits are put at power of 2
positions (1, 2, 4, 8, etc.) and Data elsewhere...
15Building a Hamming Code of Distance 3
16Family of Hamming Codes
17Flow Control (FC)
- What is it? Synchronization mechanism to allow
faster machines and slow machines to coexist on
the net - Why? The flow of faster machines is higher than
the one of slow machines - How? Throttling the sender into sending no more
than the receivers capacity - The basic principle Send n frames now but,
after they have been sent, dont send any more
until getting an OK to continue The protocol
contains well defined rules about when a sender
may transmit the next frame
18Elementary FC protocols fundamentals
- Read carefully pages 191..193 for the basic
definitions of the standard variables and
functions that are used
19Elementary FC protocols example 1
-
- The unrestricted Simplex Protocol The Utopia
Protocol (fig. 3-9, page 196)
20Elementary FC protocols Example 2
- A simplex protocol for noisy channels The stop
and wait Protocol (fig. 3-10, page 198)
21Elementary FC protocols Example 3
A positive acknowledgement with retransmission
protocol
22Elementary FC protocols Example 4
See fig. 3-13 page 205