Chapter 3 The Data Link Layer (60 % practical part)

Slides:



Advertisements
Similar presentations
Chapter 3 The Data Link Layer.
Advertisements

The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting.
5/15/2015© 2008 Raymond P. Jefferis IIILect The Data Link Layer.
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao Cleveland State University
1 Chapter Six - Errors, Error Detection, and Error Control Chapter Six.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks.
The Data Link Layer Chapter 3. Position of the data-link layer.
The OSI Reference Model
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 11 Introduction to Computer Networks.
CMPE 150 – Winter 2009 Lecture 6 January 22, 2009 P.E. Mantey.
CSC 450/550 Part 2: The Data Link Layer. CSC 450/550 Summary Part A Functions (1)Functions of the data link layer (2)Framing (3)Error control (3.1) Error.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
7/2/2015Errors1 Transmission errors are a way of life. In the digital world an error means that a bit value is flipped. An error can be isolated to a single.
20101 The Data Link Layer Chapter Design Issues Controls communication between 2 machines directly connected by “wire”-like link Services Provided.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Data Link Layer RAHUL DEVA.
Data and Computer Communications. The Data Link Layer.
Data Link Layer - 1 Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
The Data Link Layer Chapter 3. Data Link Layer Design Issues a) Services Provided to the Network Layer b) Framing c) Error Control d) Flow Control.
TOBB ETÜ ELE46/ELE563 Communications Networks Lecture 01 May 6, 2014 Fall 2011 Tuesday 10:30 – 12:20 (310) Thursday 15:30 – 17:20 (372) İsrafil Bahçeci.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
CEN 4500 Data Communications Instructor: S. Masoud Sadjadi sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
جلسه هشتم شبکه های کامپیوتری به نــــــــــــام خدا.
Chapt 3 Data Link Layer1 Data Link Layer Functions –Provides services to network layer Well-defined interface –Framing –Flow control – between adjacent.
Review:. Chapter 3: The Data Link Layer –achieve reliable, efficient communication between two physically connected machines. –Example problems to be.
Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Data Link Layer : Services, Framing, Error Detection and Correction2.
The Data Link Layer Goal –As reliable as possible, efficient communication Point-to-Point –single connection –bits arrive in order sent Not necessarily.
The data link layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
The Data Link Layer. Functions of the Data Link Layer Provide service interface to the network layer Dealing with transmission errors Error detection.
The Data Link Layer. Functions of the Data Link Layer Provide service interface to the network layer Frame delineation Dealing with transmission errors.
The Data Link Layer Chapter 3 10/28/2015www.noteshit.com1.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Data Link Layer PART III.
1 Chapter Six - Errors, Error Detection, and Error Control Chapter Six.
The Data Link Layer Chapter 3 1/21/2016www.ishuchita.com1.
Transmission Errors Error Detection and Correction.
Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
NET 221D : COMPUTER NETWORKS FUNDAMENTALS LECTURE 4: DATA LINK LAYER Behrouz A. Forouzan” Data communications and Networking 1.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Data Link Layer Chapter 3.
DATA LINK CONTROL. DATA LINK LAYER RESPONSIBILTIES  FRAMING  ERROR CONTROL  FLOW CONTROL.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
The Data Link Layer RIS 251 Dr. ir. S.S. Msanjila.
Chapter 3 The Data Link Layer.
Net 221D : Computer Networks Fundamentals
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer.
Data link layer (LLC).
Chapter 3 The Data Link Layer
Data Link Layer What does it do?
Chapter 3 – Part 1 The Data Link Layer.
Data Link Layer: Data Link Control
Overview Jaringan Komputer (2)
Net 221D : Computer Networks Fundamentals
CS412 Introduction to Computer Networking & Telecommunication
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
EEC-484/584 Computer Networks
UNIT-II The Data Link Layer.
Data Link Layer. Position of the data-link layer.
Presentation transcript:

Chapter 3 The Data Link Layer (60 % practical part)

The Introduction The study of it deals with the algorithms for achieving reliable, efficient, communication between two adjacent machines The machines are physically connected by a communication channel that acts conceptually like a wire

Data Link Layer Functions 1.Provide a well defined service interface to the network layer 2.Framing: Determine how the bits of the physical layer are grouped into frames 3.Error Control: Dealing with transmission errors 4.Flow Control: Regulate the flow of frames so that slow receivers are not swamped by fast senders

Relationship between Packets and Frames Relationship between packets and frames.

Services Provided To NL Transferring data from the NL on the source to the NL on the destination On the source machine entity (process), in the NL, that hands some bits to DLL On the destination machine the data link layer hands it over to network layer

Virtual and Actual Communication The actual transmission follows thru physical layer but it can be neglected here

Services Provided by DLL 1. Unacknowledged connectionless service 2. Acknowledged connectionless service 3. Acknowledged Connection-oriented service

1… Unacknowledged CL Service Least reliable but faster than all other The source machine sends independent frames to the destination machine without having the destination machine ack them No connection is established beforehand or released afterwards If a frame is lost due to noise burst in the channel, no attempt is made in the data link layer to recover the same

Continue… This is very appropriate when the error rate is very low and recovery is left to higher layers It is also appropriate for real-time traffic where late data is worse then bad data Many LANs have unacknowledged connectionless service in their DLL

2… Acknowledged CL Service Here each frame is individually acked If the ack frame is not arrived in some specific time interval, sender may resend Each frame sent over the connection is numbered This service is useful over unreliable medium such as wireless channel

3… Connection Oriented Service It is the most sophisticated service provided by the data link layer With this service the sender and receiver establishes a connection before any data can be transmitted The choice of CO or CL service is to be determined by the reliability of media

Continue… When C.O. services is used, three phases are involved in transfer In the first phase the connection is established by having both sides initialize variables and counters needed to keep track of which frames have been received In the second phase one or more frames are actually transmitted

Continue… In the third and final phase, the connection is released, freeing up the buffers, variables and other resources used to maintain the connection. The communication between the network layer and the data link layer uses the standard OSI service primitives, request, indication, response and confirm.

Placement of the DLL Protocol

Framing The PL provides DLL continuous bit stream of raw data without any error checking DLL breaks raw stream of data into frames and compute the checksum for each frame When a frame arrives checksum is recomputed error report or ack be sent

Ways of framing To insert time gaps between frames –As like spaces in words –it is possible these gaps might be squeezed out or other gaps might be inserted during transmission. –So four other methods are used 1.Character count. 2.Flag bytes with byte stuffing. 3.Starting and ending flags, with bit stuffing. 4.Physical layer coding violations

1… Character Count It uses a field in the header to specify the number of characters in the frame If count is garbled by the transmission, it can make the receiver go out of sync

A Character Stream With and Without Errors

2… Flag bytes with byte stuffing. Here each frame starts and ends with flag byte When binary or floating point data is being transmitted, flag byte may occur in data Sender's data link layer insert a special escape byte (ESC) just before each ''accidental'' flag byte in the data This is called byte stuffing or character stuff

Continue… It is closely tied to 8 bit characters in general and ASCII in particular Not all character code use 8 bit chars. –Ex: Unicode uses 16 bit chars. Embedding the character code having different length in the framing mechanism is not possible New technique for allowing arbitrary sized characters must be needed

3… Starting and ending flags, with bit stuffing. It allows character codes with an arbitrary number of bits per character Each frame begins and ends with a special bit pattern, namely What will happen if data also contain bit pattern –???

3… Starting and ending flags, with bit stuffing. It allows character codes with an arbitrary number of bits per character Each frame begins and ends with a special bit pattern, namely What will happen if data also contain bit pattern –Whenever the sender’s data link layer encounters five consecutive 1s it stuffs a 0

Continue… This bit stuffing is analogous to character stuffing When the receiver sees five consecutive incoming 1 bits, followed by a 0 bit, it automatically destuffs the 0 bit

Bit Stuffing Example

4… Physical Layer Coding Violations It is applicable to NWs where the encoding on the physical medium contains some redundancy Some LAN encodes 1 bit data using 2 physical bits I.e. 1 and 0 are represented using HL and LH combination in Manchester encoding Here H and L can’t occur in data So no need of stuffing if H or L is used as a flag

Continue… Many data link protocols use combination of character count with other techniques It provides two ways to check for the length of frame and provides extra safety

Error control To ensure reliable delivery is to provide the sender with feedback of other end Receiver sends back special control frames for +ve or –ve acks If a frame is lost, then receiver does not react and do not send any acks at all –Timers are introduced in the data link layer to combat this problem

Continue… When the sender transmits a frame, it generally also starts a timer If timer runs out, it warns the sender The destination may receive more then one copy of a single frame –A seq number is attached to solve the same

Flow Control When sender sends data faster then receiver can accept them, flow control becomes imp The protocol contains well defined rules about when sender may send the next frame This rules generally prohibits the sender to send the frame until the receiver permits

Two approaches are commonly used Feedback-based flow control – the receiver sends back information to the sender giving it permission to send more data Rate-based flow control –the protocol has a built-in mechanism that limits the rate at which senders may transmit data,

Error Detection and Correction Transmission errors are fact of life so the only option available to us is to learn how to deal with them Transmission without error is not possible at all

Error Types Singly Error –Just one bit interchanged –Easy to catch and correct Burst Error –More than one bit interchanged –Difficult to catch and correct –If in 1000 bit long frame 35 th no bit and 134 th no bit has interchanged than it is the burst error of length 100.

Strategies For Handling Errors 1.Error Correcting Codes  include enough redundant information along with each block of data sent  So that the receiver can deduce what the transmitted data must have been.  Also known as forward error correction  No need of retransmission 2.Error Detecting Codes  include only enough redundancy to allow the receiver to deduce that an error occurred  Must be retransmitted

Where to use What On channels that are highly reliable, such as fiber retransmission is better –Error detection should be used On channels such as wireless links that make many errors retransmission is costly –Error correction strategy should be used

Error Correcting and Detecting Codeword –Data bits + Check bits –If Frame contains ‘m’ data bit and ‘r’ redundant bits, –Length is m + r = n

Error Correcting and Detecting Hamming distance –The number of bit positions in which two codewords differ is the Hamming distance –Given any two code words, say and it is possible to determine how many bits differ, using EXOR Ans = ???

Error Correcting and Detecting Hamming distance –The number of bit positions in which two codewords differ is the Hamming distance –Given any two code words, say and it is possible to determine how many bits differ, using EXOR Ans = 3

Hamming Distance of Whole code For m bit frame 2 m frames are possible –So 2 m legal codewords Because for n bit codewords –2 n codewords are possible In the list of all legal codewords two codewords having the minimum distance is hamming distance of whole code

Significance of Hamming Distance Hamming distance (d) tells that one codeword need ‘d’ single bit errors to be converted to another codeword To detect d errors, you need a distance d + 1 code to correct d errors, you need a distance 2d + 1 code

Error correcting code (Hamming code) 1.Count down the no of check bits satisfying formula (m+r+1)<=2 r 2.Check bits = 1,2,4,8,16,32,64…. 3.Data bits = 3,5,6,7,9,10,11,12,13,14,15…. 4.1 is responsible for the parity of 1,3,5,7… 5.2 = 2,3,6,7,10,11,14,15… 6.4 = 4,5,6,7,12,13,14,15… 7.8 = 8,9,10,11,12,13,14,15….

(Hamming code) Send the data At the receiving side from the received codeword calculate the parity of each check bit Add all the check bits which does not have right parity Answer is the bit where the error has occurred

Example A byte of data: Create the data word, leaving spaces for the parity bits: _ _ 1 _ _ Calculate the parity for each parity bit (a ? represents the bit position being set): Position 1 checks bits 1,3,5,7,9,11: ? _ 1 _ _ Even parity so set position 1 to a 0: 0 _ 1 _ _ Position 2 checks bits 2,3,6,7,10,11: 0 ? 1 _ _ Odd parity so set position 2 to a 1: _ _

Example Position 4 checks bits 4,5,6,7,12: ? _ Odd parity so set position 4 to a 1: _ Position 8 checks bits 8,9,10,11,12: ? Even parity so set position 8 to a 0: Code word:

Example At the receiving side verify each check bit. Write down all the incorrect parity bits. suppose the codeword we received is instead of Parity bits 1,2 are correct Parity bits 4,8 are incorrect So at 4+8=12 th bit error has occurred.

Using Hamming Code for Burst Errors

Checking For Burst Errors k codewords are arranged as a matrix Instead of sending codeword send columns Receiver will reconstruct the matrix If burst error occurred of length k than at most one bit per codeword is incorrect and can be corrected

Burst Error Correction using Hamming Code

Error detecting codes To detect single bit error –Add parity bit to each bloke To detect burst error of length k –Divide the block in k words –Arrange k words in sequence to form matrix –Add parity bit for each column –Send the block Row-wise.

Polynomial Code or CRC Method (Second method to detect burst errors) Polynomial codes are based upon treating bit strings as representations of polynomials with coefficients of 0 and 1 only is x 5 +x 4 +x 0 In this method a generator polynomial is first agreed upon by receiver and the sender Both high and low order bits of the generator polynomial must be one

The Standard Polynomials Certain polynomials have become international standards. The one used in IEEE 802 is a polynomial code with r check bits will detect all burst errors of length <= r.

G(x) and Checksum The frame must be bigger then the generator polynomial G(x) Append the frame by 0’s No of 0’s = degree of generator polynomial G(x) The frame is divided by G(x) remainder is subtracted form frame yielding T(x) When the receiver gets the frame, it tries to divide the frame by G(x)

Is replaced by reminder

CRC at Sender Side

CRC at Receiver Side

Protocols Unidirectional Protocols –An Unrestricted Simplex Protocol –A Simplex Stop-and-Wait Protocol –A Simplex Protocol for a Noisy Channel Bidirectional Protocols (sliding window) –A One-Bit Sliding Window Protocol –A Protocol Using Go Back N –A Protocol Using Selective Repeat

Unidirectional Protocols An Unrestricted Simplex Protocol –No flow control –No error control A Simplex Stop-and-Wait Protocol –Flow control –No error control A Simplex Protocol for a Noisy Channel –Flow control –Error control

1… An Unrestricted Simplex Protocol Data are transmitted in one direction only. Both the transmitting and receiving NLs are always ready the communication channel between the data link layers never damages or loses frames thoroughly unrealistic protocol

Algorithm

Sender Receiver f2F3f4 f1 f5 to_phisical_layer(&s) from_phisical_layer(&s) No Flow Control An Unrestricted Simplex Protocol

2... A Simplex Stop-and-Wait Protocol Flow control –Receiver will send acknowledgement for each received frame Error control –Not present

Algorithm

Sender Receiver a0 f1 a1 to_phisical_layer(&s) from_phisical_layer(&s) With Flow Control f0 a0 A Simplex Stop-and-Wait Protocol Time 0 N

3… A Simplex Protocol for a Noisy Channel Flow control –Acknowledgement from receiver Error control –Lost frames Timer timeout and retransmission –Lost Acknowledgements Same but problem of duplication –Duplication Sequence no added to each frame header

Sender Receiver to_phisical_layer(&s) from_phisical_layer(&s) With Flow Control + Error Control A Simplex Protocol for a Noisy Channel a0 f1 a1 f0 a0 Normal Transmission Time 0 N

Case 1:- Frame Lost Sender Receiver to_phisical_layer(&s) from_phisical_layer(&s) a0 f1 a1 f0 f1 Time 0 N

Case 1:- Ack Lost & Duplication Sender Receiver to_phisical_layer(&s) from_phisical_layer(&s) a0 f1 a1 f0 a1 f1 Time 0 N a1

Sliding Window Protocols (Bidirectional Transmission) It is for bi-directional transmission Piggybacking –Ack for received frame is sent in data frame to be sent. –Frame = Data + Seq_no + Ack_no

Window No of buffers to store sending or receiving frame Whenever frame is sent it is stored in sending window’s buffers Whenever frame received it is stored in receiving window’s buffers

Window When expected ack comes from receiver, frame is discarded from sending window Whenever frame is passed to NL it is removed from receiving window

a) initially b) after the first frame has been sent c) after the first frame has been received d) after the ack is received A Sliding window of size 1 with three bit seq no.

1… A One Bit Sliding Window Protocol Bidirectional transmission Only one frame can be sent Second can be sent only after the ack of first Window size = 1 buffer only –Because only 1 bit is allotted for seq no (0 to 1) Timer is started after transmission of each frame

A B 0,0,b1 1,0,a2 1,1,b2 to_phisical_layer(&s) from_phisical_layer(&s) 0,1,a3 0,1,a1 0,0,b3 Time 0 N

A One Bit Sliding Window Protocol

Comparison

Moving to more sophisticated protocols Time between frame sent & ack received is considerable in real situations Pipelining:- –If sender can send frame before getting acknowledgement channel utilization increases To do this sender will need buffers to store the sent frames

Effect of Error

Sliding Window Diagram

Go Back N

A Protocol Using Selective Repeat Receiver is also provided by receiving window So if expected frame doesn’t come receiver can receive frame out of order instead of discarding it.

Algorithm

Window Management a) Initial Situation with WS 7 b) After 7 frames sent but not acked c ) Initial situation with a window size of four d) After four frames sent and received but not acked