Data Link Layer
Agilandeeswari L,AP/SITE
Introduction
Two main functions of the data link layer are data link control and media access control. Data link control functions include framing, flow and error control, and software implemented protocols that provide smooth and reliable transmission of frames between two adjacent nodes.
Agilandeeswari L,AP/SITE
Functions of the Data Link Layer
The goal of the data link layer is to provide reliable, efficient communication between adjacent machines connected by a single communication channel. Specifically: Framing Error Control -Error Correction & Detection Flow control Provide service to the network layer. - The network layer wants to be able to send packets to its neighbors without worrying about the details of getting it there in one piece.
Agilandeeswari L,AP/SITE
Framing
The data link layer has a number of specific functions it can carry out. These functions include Providing a well-defined service interface to the network layer Dealing with transmission errors Regulating the flow of data. So that slow receivers are not swamped by fast senders. To accomplish these goals, the data link layers takes the packets it gets from the network layer and divided them into smaller frames for transmission.
Agilandeeswari L,AP/SITE
Types of Framing
Frames can be of fixed or variable size.
Fixed-Size Framing:
In fixed-size framing, there is no need for defining the boundaries of frames. An example, framing used in ATM wide-area network, which uses frames of fixed size.
Variable -Size Framing:
In variable size framing, we need a delimiter (flag) to define the boundary of two frames that is the end of the frame and the beginning of the next.
Agilandeeswari L,AP/SITE
Variable -Size Framing Approach
Two approaches were used for variable-size framing:
Character-oriented approach and Bit-oriented approach
In a byte-oriented protocol, the data (payload) section of a frame is a sequence of bytes; in a bit -oriented protocol, the data (payload) section of a frame is a sequence of bits.
Agilandeeswari L,AP/SITE
Character-Oriented (or Byte-Oriented) Protocols:
In this, data to be carried are 8 bit characters from a coding system such as ASCII. The header normally carries the source and destination addresses and other control information. The trailer carries error detection or correction redundant bits. To separate one frame from the next frame, an 8 bits (1-byte) flag is added at the beginning and the end of a frame.
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Bit-Oriented Protocols
Here the data section of a frame is a sequence of bits to be interpreted by the upper layer as text, graphic, audio, video and so on. In addition to headers and trailers, a special 8bit pattern flag 01111110 as the delimiter to define the beginning and the end of the frame.
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Bit Stuffing
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag.
Agilandeeswari L,AP/SITE
Flow and error control
The most important issues related to the data link layer of the OSI model are flow control and error control. Collectively, these functions are known as data link control.
Flow control:
It refers to a set of procedures used to restrict the amount of data that the sender can send before receiving an acknowledgement from the receiver.
Error control:
This concept allows the sender to know about damaged or lost frames. This allows retransmission of such frames so that no data is lost. This concept deals with error detection and correction.
Agilandeeswari L,AP/SITE
Protocols
The protocols are normally implemented in software by using one of the common programming languages. Here we will discuss about the protocols that can be used for noiseless (error- free) and noisy (error-creating) channels.
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Flow Control
Flow control is a collection of techniques that allows the sender to know how much data it can send before it must receive an acknowledgement from the receiver. In other words, this concept tells the sender how much data it can send without clogging the receiver. The reason for this concept is that any device has a restricted speed and capacity at which it can accept incoming data. If this were exceeded, data would be lost. Flow control prevents such losses. Two main techniques have been developed to control the flow of data across communication links:
Stop-and-wait and Sliding window
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Stop-and-Wait:
This is a very simple method, the sender sends one frame of data and necessarily waits for an acknowledgement (ACK) from the receiver before sending the next frame. Transmission always takes the form Data-ACKData-ACK etc., where the data frames are sent by the sender, and the ACK frames are sent by the receiver back to the sender.
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Analysis:
Here two events can occur: a request from the network layer or an arrival notification from the physical layer. This algorithm will ignore all other network layer requests until it receives an acknowledgement for the frame it sent. It is processed by means of a variable called CanSend. When a frame is sent, this variable is set to false, when an ACK is received, CanSend is set to true to allow sending of the next frame.
Agilandeeswari L,AP/SITE
Advantages:
(i) Each frame is checked and acknowledged before the next frame is sent. (ii) It will avoid the error during transmission. Disadvantages:
Inefficiency: Stop and wait makes the transmission very slow
Agilandeeswari L,AP/SITE
ERROR CONTROL
In the data link layer, the term error control refers primarily to methods of error detection and retransmission. Whenever an error is detected, a negative acknowledgement (NAK) is sent to the sender. The sender retransmits the frames. This technique is known by the name of Automatic Repeat Request (ARQ). Error control in the datalink layer is based on automatic repeat request (ARQ), which means retransmission of data in three cases:
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Stop-and-wait ARQ is a form of stop-and-wait flow control extended to include retransmission of data in case of lost or damaged frames. It adds a simple error control mechanism to the stop and wait protocol. Error correction in stop-and wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires. In stop-and wait ARQ, we use sequence numbers to number the frames. The sequence numbers are based on modulo-2 arithmetic. The acknowledgment numbers always be the sequence number of the frame expected by the receiver. For example, if frame 0 has arrived to the receiver, it sends an ACK frame with acknowledge 1 (frame 1 is expecting) If frame 1 has arrived to the receiver, it sends an ACK frame with acknowledge 0 (frame 0 is expecting).
Agilandeeswari L,AP/SITE
Features to be added: For retransmission to work, the four features are added to the error control mechanism. The sending device keeps a copy of the last frame transmitted until it receives an acknowledgement for that frame. For identification purposes, both data frames and ACK frames are numbered alternately 0 and 1. A data 0 frame is acknowledged by an ACK1 frame, indicating that the receiver has received data 0 and is now expecting data 1. If an error is discovered in a data frame, indicating that it has been corrupted in transit, a NAK frame is returned. NAK frames, which are not numbered, tell the sender to retransmit the last frame sent. The sending device is equipped with a timer. If an expected acknowledgement is not received within an allotted time period, the sender assumes that the last data frame was lost in transit and sends it again.
Agilandeeswari L,AP/SITE
Damaged Frame
Agilandeeswari L,AP/SITE
Stop-and-wait ARQ, lost data frame
Agilandeeswari L,AP/SITE
Stop-and-wait ARQ, lost ACK frame
Agilandeeswari L,AP/SITE
Sliding window
In the sliding window method of flow control, the sender can transmit several frames before needing an acknowledgement. Frames can be sent one after another, meaning that the link can carry several frames at once and its capacity can be used efficiently. The receiver acknowledges only some of the frames, using a single ACK to confirm the receipt of multiple data frames. Two popular sliding window flow control mechanisms are,
Go-back-n ARQ and Selective reject ARQ
Agilandeeswari L,AP/SITE
Go-Back-N ARQ
In the Go-back-n ARQ technique of error detection and correction, the sender starts retransmission with the last unacknowledged frame, even if the subsequent frames have arrived correctly at the receiver. Go-BackN ARQ protocol, it can send several frames before receiving acknowledgements and keep a copy of these frames until the acknowledgements arrive. Here the sequence numbers are 2m, Where m is the size of the sequence number fields in bits. For example m is 3, the sequence numbers are 1,2,3,4,5,6,7,8,
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Design of Selective Repeat ARQ
In selective-reject ARQ, only the specify damaged or lost frame is retransmitted. If a frame is corrupted in transit, a NAK is returned and the frame is resent out of sequence. The receiving device must be able to sort the frames it has and insert the retransmitted frame into its proper place in the sequence. Here the size of the sender and receiver window must be at most one-half of 2m
Agilandeeswari L,AP/SITE
Agilandeeswari L,AP/SITE
Data Link Layer Accessing the Media
Logical Link Control : The LLC sublayer
is primarily concerned with: Multiplexing protocols transmitted over the MAC layer (when transmitting) and decoding them (when receiving). Providing node-to-node flow and error control
Media Access Control: MAC determines who is allowed to access the media at any one time (usually CSMA/CD).
Agilandeeswari L,AP/SITE
Media Access Control Techniques
Agilandeeswari L,AP/SITE
Media Access Control Techniques
There are two basic media access control methods for shared media: 1. Controlled - Each node has its own time to use the medium 2. Contention-based - All nodes compete for the use of the medium
Agilandeeswari L,AP/SITE
Contention Based Access
Agilandeeswari L,AP/SITE
Media Access Control Techniques
Simplex, Half Duplex and Full Duplex modes
Agilandeeswari L,AP/SITE
Media Access Control Techniques
Purpose of a logical topology and identify several common logical topologies
The physical topology is an arrangement of the nodes and the physical connections between them. The representation of how the media is used to interconnect the devices is the physical topology. A logical topology is the way a network transfers frames from one node to the next. This arrangement consists of virtual connections between the nodes of a network independentAgilandeeswari of their physical layout. L,AP/SITE
Media Access Control Techniques
Agilandeeswari L,AP/SITE
Media Access Control Techniques
Characteristics of multi-access topology and implications for media access when using this topology
Agilandeeswari L,AP/SITE
Media Access Control Techniques
Ring Topology
Agilandeeswari L,AP/SITE
Media Access Control Addressing and Framing Data
Purpose of encapsulating packets into frames to facilitate the entry and exit of data on media
Agilandeeswari L,AP/SITE
Media access control addressing and framing data
Role of addressing in the Data Link layer and identify cases where addresses are needed and cases where addresses are not needed
Agilandeeswari L,AP/SITE