×

Data Link Control

Data-link control is the main function of the data link layer. It deals with the configuration and coordination for connection between two neighboring nodes: node-to-node communication. The task of the data link layer includes error-control, software-implemented protocols, flow-control, and framing that provide efficient and smooth transmission of frames between nodes.

Framing

The data link layer separates the bit-stream obtained from the network layer into usable data units called frames.

Data Link Control

Flow control

Flow control is one of the essential duties of the data link layer. It manages the amount of data that can be sent before obtaining confirmation. Flow control is a set of methods that tell the sender how much data it can transmit before the receiver is overloaded. Any receiving device has limited speed and limited memory for the process of incoming data and storage of the incoming data.

Data Link Control

 Error control

Error control includes both methods of error detection and error correction. The error control helps the receiver to notify the sender of any lost frames or damaged frames during the transmission. It allows to retransmission of those frames by the sender. At the data link layer, error control is often easily implemented: whenever an error is detected at the frames, those frames are re-transmitted.

Protocols

The protocols usually use one of the common programming languages to execute the software. Protocols are divided into two categories: Noiseless channel and Noisy channel. The diagram of protocols structure is shown below.

Data Link Control

Noiseless channel

The noiseless channel is divided into two sub-categories: Simplest protocol and Stop-and-Wait protocol. The first protocol of this channel does not use flow control, but the second protocol uses flow control.

Simplest Protocol

In this protocol, it doesn't use the flow and error control. It is a unidirectional protocol where data frames only travel from sender to receiver in one direction. The design of the simplest protocol with no flow control or error control is shown below.

Data Link Control

Algorithm

Sender-site algorithm for the simplest protocol

while(true)           // Repeat forever
{
WaitForEvent();       // Sleep until an event occurs  
If (Event (RequestToSend))   // There is a packet to send
{   
 GetData();  
 MakeFrame();   
 SendFrame();       // Send the frame}}

Receiver-site algorithm for the simplest protocol

while(true)             // Repeat forever
{
WaitForEvent();        // Sleep until an event occurs 
If (Event (ArrivalNotification))            // Data frame arrived
{          
ReceiveFrame();         
ExtractData();          
DeliverData();          // Deliver data to network layer}}

For example: The simplest protocol is very simple. The sender sends frames in the sequence without really knowing about the receiver. In this protocol to send three frames, there are three events at the sender and three events at the receiver. These events are shown below in the figure.

Stop-and-Wait Protocol

The sender sends a frame in the Stop-and-Wait protocol, and it stops until when the receiver receives the data and then sends the next frame. In this protocol, adds the flow control. This protocol is a unidirectional protocol for data frames, but auxiliary ACK (Acknowledgment) frames travel from other directions. The design of the Stop-and-Wait protocol is shown below.

Data Link Control

Algorithm

Sender-site algorithm for the simplest protocol

while (true)              // Repeat forever
canSend = true           // Allow the first frame to go 
{      
WaitForEvent ( );             // Sleep until an event occurs    
If (Event (RequestToSend) AND canSend)          
  {            
GetData ( );          
MakeFrame ( );          
SendFrame ( );                   // Sleep the data frame       
canSend = false;                // Cannot send until ACK arrives            
 }
WaitForEvent ( );               // Sleep until an event occurs  
    if (Event (ArrivalNotification))              // An ACK has arrived           
 {             
    ReceiveFrame ( );  
       // Receive the ACK frame           
      canSend = true;      
      }
}

Receiver-site algorithm for the simplest protocol

while (true)                  // Repeat forever{                                
 WaitForEvent ( );         // Sleep until an event occurs     
 If (Event (ArrivalNotification))      // Data frame arrives  
   {   
ReceiveFrame ( );    
ExtractData ( );        
Deliver (data);         // Deliver data to network layer           
SendFrame ( );        // Send an ACK frame   
   }
}

For example: The stop-and-wait protocol is very simple. The sender transmits a frame and wait for the receiver response. The sender transmits the next frame after arrives the ACK of the previous frame.

Note that sending three frames in this example involves the sender in six events and the receiver in three events. These events are shown below in the figure.

Data Link Control

Noisy Channels

The noisy channel is divided into three sub-categories:

  1. Stop-and-Wait automatic repeat request
  2. Go-back-N automatic repeat request
  3. Selective repeat automatic repeat request

Stop-and-Wait Automatic Repeat Request

Stop-and-wait automatic repeat request is a protocol that is used in tele-communications to transfer the data between two connected systems. 

In the stop-and-wait automatic repeat request protocol, the sender sends one frame at a time. The sender transmits a frame and waits for the receiver response. The sender transmits the next frame after it arrives acknowledgment (ACK) signal of the previous frame. When the acknowledgment (ACK) does not reach the sender within a specified time, the sender sends the same frame again.   

At the end of each frame, the sender adds redundancy bits. At the receiver-end, these redundancy bits are used to check the damage of the frames.

In this protocol, we need a sequence number for the frames. The design of the Stop-and-Wait ARQ protocol is shown below.

Data Link Control

Algorithm

Sender-site algorithm for the Stop-and-wait ARQ protocol

Sn = 0;            //Frame 0 should be sent first    
canSend = true;     // Allow the first request to go 
while (true)         // Repeat forever
{    
 WaitForEvent ();       // Sleep until an event occurs     
  if (Event  (RequestToSend) AND canSend)      
 {             GetData (); 
    MakeFrame (Sn);                 // The seqNo is Sn           
  StoreFrame (Sn);              // Keep copy             
 SendFrame (Sn);           
  StartTimer ();            
 Sn = Sn + 1 ;           
 canSend = false ;      
 }    
 WaitForEvent ();                // Sleep        
 if (Event  (ArrivalNotification) )      // An ACK has arrived       
{             
ReceiveFrame (ackNo) ;         // Receive the ACK frame            
 if (not corrupted AND ackNo == Sn)    // valid ACK                   
{            
  Stoptimer ();          
 PurgeFrame ( Sn-1 ) ;            // copy is not needed                           
canSend = true ;                   
 }         
}        
if ( Event (TimerOut))            // The timer expired        
 {              
 StartTimer () ;              
 ResendFrame (Sn-1) ;         
 }
}                             

Receiver-site algorithm for the Stop-and-Wait ARQ protocol

Rn = 0 ;             // Frame 0 expected to arrive 
firstwhile ( true )
 {       
 WaitForEvent() ;       // Sleep until an event occurs       
 if ( Event (ArrivalNotification) )   // Data frame arrives        
   {         ReceiveFrame () ;    
  if (corrupted (frame) );      
      Sleep () ;          
 if ( seqNo == Rn )        // Valid data frame                  
  {           
  ExtractData () ;        
   DeliverData () ;            // Deliver data             
     Rn = Rn   +  1 ;                 
    }       SendFrame (Rn) ;     // Send an ACK           
  }
}          

 The example of Stop-and-Wait ARQ is shown below in the figure.

Data Link Control

Go-Back-N ARQ

Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat Request. It is a data link layer protocol that uses a sliding window method. In this, if any frame is corrupted or lost, all subsequent frames have to be sent again.

The size of the sender window is N in this protocol. For example, Go-Back-8, the size of the sender window, will be 8. The receiver window size is always 1.

If the receiver receives a corrupted frame, it cancels it. The receiver does not accept a corrupted frame. When the timer expires, the sender sends the correct frame again. The design of the Go-Back-N ARQ protocol is shown below.

Data Link Control

The example of Go-Back-N ARQ is shown below in the figure.

Data Link Control

Selective Repeat ARQ

Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request. It is a data link layer protocol that uses a sliding window method. The Go-back-N ARQ protocol works well if it has fewer errors. But if there is a lot of error in the frame, lots of bandwidth loss in sending the frames again. So, we use the Selective Repeat ARQ protocol. In this protocol, the size of the sender window is always equal to the size of the receiver window. The size of the sliding window is always greater than 1.

If the receiver receives a corrupt frame, it does not directly discard it. It sends a negative acknowledgment to the sender. The sender sends that frame again as soon as on the receiving negative acknowledgment. There is no waiting for any time-out to send that frame. The design of the Selective Repeat ARQ protocol is shown below.

Data Link Control

The example of the Selective Repeat ARQ protocol is shown below in the figure.

Data Link Control

Piggybacking

It is used to increase the performance of the bidirectional protocols. In piggybacking, if node A sends a data to node B, it can also give the node-A information about the frame coming (or lost) from node B. if node B sends a data to node A, it can also give the node B information about the frame coming from node A.


Related Topics

Domain Name System in Computer Network

Domain Name System Domain Name System is also called DNS. DNS was introduced by Paul Mockapetris and Jon Postel in 1983. DNS is an internet service that converts Domain names to...

2 minutes read.

Aloha

Aloha Norman Abramson and his colleagues were developed aloha at the University of Hawaii in the 1970s. ALOHA is a Multiple Access Protocol which is used for random access in the...

3 minutes read.

E-mail in Computer Network

E-mail E-mail stands for electronic mail. E-mail is an application layer service in which a user can transfer the messages and information with another user. E-mail is the most popular service...

2 minutes read.

Computer Network Architecture

Computer network architecture is a design in which all the computers are organized in a computer network. The architecture defines how computers must communicate with each other to obtain maximum...

4 minutes read.

Cyclic Redundancy Check Example

What is Cyclic Redundancy Check? A cyclic redundancy check (CRC) is a type of error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data....

5 minutes read.

Star Topology in Computer Networks

Star topology comes from or is a part of the network topology which was invented by Dr.Howard Frank. It is also to be known as star network because of its...

4 minutes read.

Computer Network Topology: Bus, Star, Ring, Tree and Hybrid

Network Topology: The Computer network topology refers to the layout of connected devices on a network. The network topology is the combination by which computer or network devices interconnected to...

4 minutes read.

What is Computer Network?

 A computer network is a collection of interconnected devices, such as computers, servers, routers, and switches, that are connected together to share resources and exchange data. These devices use a...

6 minutes read.

Working of ARP

The majority of computer programmes and applications send and receive messages using logical addresses (IP addresses), but the actual communication takes place over physical addresses (MAC addresses), which is found...

4 minutes read.

Session Layer in OSI Model

This article will help you in getting a better understanding of the Session layer in the OSI model. The session layer is the fifth layer from the bottom in the OSI...

4 minutes read.

Transmission Media

Transmission Media: The physical layer directly controls transmission media. A transmission medium is a way which transmits the data from one place to another. It carries the data from source...

5 minutes read.

Classes of Routing Protocols

In this tutorial, we will discuss about the classes of the routing protocols. Routing: What is it? Routing in computer networks is a procedure in which the layer 3 or network layer...

7 minutes read.

Ring Topology in Computer Network

Ring topology is a topology that was invented by IBM in 1984 by the Institute of Electrical and Electronics Engineers. It is defined as a type of network topology where...

4 minutes read.

Session Layer and Presentation Layer

Session Layer and Presentation Layer Session Layer The fifth layer is the Session layer in the OSI model, which controls connections between many computers. It manages, establishes, and terminates the session connection...

2 minutes read.

Two Port Network in Computer Networks

A Two Port Network is a four-terminal electric network or circuit with 2 terminals on both sides, each connecting with more circuits or devices. Two terminals together make a port, one...

5 minutes read.

Fixed and Flooding Routing Algorithms

Introduction Before going to study fixed and flooding routing algorithms, we have to take a look back to revisit the topic of routing. Routing can be defined as Routing: What is it? Routing...

3 minutes read.

Transport Layer in OSI Model

This article will help you in getting a good understanding of the transport layer in the OSI model. The transport layer is the fourth layer from the bottom in the OSI...

4 minutes read.

TCP vs UDP

Transmission Control Protocol (TCP) and User Datagram Protocol are the two most popular Internet protocols (IPs). TCP is a connection-oriented protocol, which means that once a connection has been made,...

4 minutes read.

Stream Control Transmission Protocol

Stream Control Transmission Protocol: SCTP stands for Stream Control Transmission Protocol. SCTP was developed by the Internet Engineering Task Force (IETF). It is a reliable message-oriented protocol of the transport...

3 minutes read.

Computer Network Tutorial

What is Data Communication and Computer Network? Data Communication is the process of exchanging digital data between two or more computers that act as source and receiver through wireless media or...

7 minutes read.