0% found this document useful (0 votes)
5 views39 pages

CN Unit Ii

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views39 pages

CN Unit Ii

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

CN

UNIT II
• THE DATA LINK LAYER DESIGN ISSUES
• FUNCTIONS
• 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 –flow control.

The two main functions of the data link layer are:


• Data Link Control (DLC): It deals with the design and procedures for
communication b/w nodes: node-to-node communication.
• Media Access Control (MAC): It explains how to share the link.
• DATA LINK CONTROL (DLC): Data link control
functions includes
 Framing.
 Error Control.
 Flow Control.

• FRAMING
• The frame contains
– Frame header
– Payload field for holding packet
• Frame trailer
• Services provided to the network layer
• Transferring data from the network layer on the source
machine to the network layer on the destination machine. The
data link layer can be designed to offer various services.
• The actual services offered can vary from system to system.
Three reasonable possibilities that are commonly provided are
• Unacknowledged connectionless service
– Source machine sends independent frames to destination
machine having destination machine acknowledge them
– No logical connection

• Acknowledged connectionless service


– No logical connection
– Each frame sent is individually acknowledged

• Acknowledged connection-oriented service


– DLL guarantees that...
• Each frame is received
• Each frame is received exactly once
• Each frame is received in the right order
• FRAMING
• There are four methods:
• Character count.
• Flag bytes with byte stuffing.
• Starting and ending flags, with bit stuffing.
• Physical layer coding violations.
• Character count:

• Figure 3-4. A character stream. (a) Without errors. (b)


With one error.
• Flag bytes with byte stuffing:
• Advantage:

• Simple framing method.


• Character-oriented framing was popular when only text was
exchanged by the data Link layers.
• The flag could be selected to be any character not used for text
communication.
• Starting and ending character with byte stuffing
• Figure : Byte stuffing and unstuffing
• Fig: Framing with byte stuffing
• Bit-Oriented framing approach
– Bit stuffing is the process of adding one extra 0 whenever
five consecutive 1’s follow a 0 in the data, so that the
receiver does not mistake the pattern 0111110 for a flag.
– Most protocols use a special 8-bit pattern flag 01111110 as
the delimiter to define the beginning and the end of the
frame, as shown in Figure below
• 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.
• ERROR CONTROL

• How do we make sure that all frames are eventually delivered to the
network layer at the destination and in the proper order?
• Provide sender with some acknowledgement about what is happening with
the receiver
• Sender could wait for acknowledgement

• TYPES OF ERRORS

• Single bit error: Only one bit gets corrupted. Common in Parallel
transmission.

• Burst error: More than one bit gets corrupted very common in serial
transmission of data occurs when the duration of noise is longer than the
duration of one bit.
• Single bit error:The term single-bit error means that only one
bit of given data unit (such as a byte, character, or data unit) is
changed from 1 to 0 or from 0 to 1.
• Burst error:
• More than one bit gets corrupted very common in serial
transmission of data occurs when the duration of noise is
longer than the duration of one bit.
• The noise affects data; it affects a set of bits.
• ERROR DETECTION TECHNIQUES
• Cyclic redundancy check (CRC)
• Unlike checksum scheme, which is based on addition, CRC is
based on binary division.
• In CRC, a sequence of redundant bits, called cyclic
redundancy check bits, are appended to the end of data unit so
that the resulting data unit becomes exactly divisible by a
second, predetermined binary number.
• At the destination, the incoming data unit is divided by the
same number. If at this step there is no remainder, the data unit
is assumed to be correct and is therefore accepted.
• CRC
• ELEMENTARY DATA LINK LAYER PROTOCOLS
• PROTOCOLS
• The protocols are normally implemented in software by using
one of the common programming languages.
• NOISELESS CHANNELS
• Simplest Protocol
• It has no flow or error control. It is a unidirectional protocol
in which data frames are traveling in only one direction-from
the sender to receiver.
• The data link layer of the receiver immediately removes the
header from the frame and hands the data packet to its network
layer, which can also accept the packet immediately
• Stop-and-Wait Protocol
• If data frames arrive at the receiver site faster than they can be
processed, the frames must be stored until their use.
• In Stop-and-Wait Protocol the sender sends one frame, stops
until it receives confirmation from the receiver (okay to go
ahead), and then sends the next frame.
• Noisy Channels:
• 1. Stop-and-Wait Automatic Repeat Request
• The Stop-and-Wait Automatic Repeat Request (Stop-and-Wait
ARQ), adds a simple error control mechanism to the Stop-and-
Wait Protocol.
• To detect and correct corrupted frames, we need to add
redundancy bits to our data frame.
• When the frame arrives at the receiver site, it is checked and if
it is corrupted, it is silently discarded.
• The detection of errors in this protocol is manifested by the
silence of the receiver.
Stop-and-Wait Automatic Repeat Request
• Go-Back-N Automatic Repeat Request
• A data link layer protocol that uses a sliding window
mechanism for reliable data transmission.
• It allows a sender to transmit multiple frames (up to a window
size 'N') without waiting for acknowledgements.
• If a frame is lost or times out, the sender retransmits that
frame and all subsequent frames within the window.
• In Go-Back-N Automatic Repeat reQuest (ARQ), the sender's
window size is represented by the variable ‘2^n-1', while the
receiver's window size is always 1.
• This means the sender can transmit up to N frames before needing
an acknowledgment, and the receiver acknowledges frames
individually, one at a time.
• Go-Back-N Automatic Repeat Request
• FLOW DIAGRAM
• Sliding Window
• The sliding window is an abstract concept that defines the
range of sequence numbers that is the concern of the sender
and receiver.
• In other words, the sender and receiver need to deal with only
part of the possible sequence numbers.
• The range which is the concern of the sender is called the send
sliding window.
• The range that is the concern of the receiver is called the
receive sliding window.
• Sliding Window
• Selective Repeat Automatic Repeat Request
• Go-Back-N ARQ simplifies the process at the receiver site.
• The receiver keeps track of only one variable, and there is no need to
buffer out-of-order frames; they are simply discarded.
• However, this protocol is very inefficient for a noisy link.
• In a noisy link a frame has a higher probability of damage, which means
the resending of multiple frames.
• This resending uses up the bandwidth and slows down the transmission.
• The sender's window size is represented by the variable ‘2^n-1', while the
receiver's window size is always 2^n-1.
• Design of Selective Repeat ARQ
• 1. Initial State
• Sender (A):
– Sequence numbers available: 0 to 7
– Sending window: Initially open for all 8 frames.
• Receiver (B):
– Ready to receive sequence number: 0
– Receiving window: 0 to 7
• 2. Frame 0 Transmission
• Sender sends Frame 0
• Receiver receives Frame 0 correctly
– Sends ACK 1 (acknowledges receipt of frame 0 and readiness for frame 1)
– Receiver updates Rn to 1
• 3. Frame 1 Transmission
• Sender sends Frame 1
• Frame 1 is lost during transmission
• 4. Frame 2 and Frame 3 Transmission
• Sender continues with Frame 2 and Frame 3
– These are received correctly by the receiver.
– Receiver identifies gap (missing frame 1) and sends NAK 1
– Receiver buffers frames 2 and 3 (cannot deliver yet)
• 5. Resending Lost Frame (Frame 1)
• Sender resends Frame 1 upon receiving NAK 1
• Receiver receives Frame 1 successfully
• 6. ACK 4 Sent by Receiver
• Since frames 1, 2, and 3 are now in sequence and all received:
– Receiver sends ACK 4
– Indicates readiness for frame 4
– Delivers frames 1, 2, and 3 to the upper layer
• HDLC (High-level Data Link Control)
• is a bit-oriented synchronous data link layer protocol used to ensure the error-free
transmission of data to respective destinations and control the speed at which data
is transmitted.
• HDLCs provide both connection-oriented and connectionless services. High-level
data link control is a set of protocols that defines rules for transmitting data
between network points.
• Data in HDLC is organized into units called frames and is sent across networks to
specified destinations.
• HDLC frames are transmitted over synchronous links or asynchronous links, which
do not mark the start and end of frames.
• This is done using a frame delimiter or flag, which contains unique sequence of bits
that are not visible inside a frame.
• HDLC is a bit - oriented protocol where each frame contains up to six fields. The
structure varies according to the type of frame. The fields of a HDLC frame are −
• Flag − It is an 8-bit sequence that marks the beginning and the end of the frame.
The bit pattern of the flag is 01111110.
• Address − It contains the address of the receiver. If the frame is sent by the
primary station, it contains the address(es) of the secondary station(s). If it
is sent by the secondary station, it contains the address of the primary
station. The address field may be from 1 byte to several bytes.
• Control − It is 1 or 2 bytes containing flow and error control information.
• Payload − This carries the data from the network layer. Its length may vary
from one network to another.
• FCS − It is a 2 byte or 4 bytes frame check sequence for error detection.
The standard code used is CRC (cyclic redundancy code)
There are three types of HDLC frames:
• Information frames/User data (I-frames)
• Supervisory frames/Control data (S-frames)
• Unnumbered frames (U-frames)

The common fields within an HDLC frame are:


• Flag
• Address
• Control information
• Frame check sequence
• The following diagram details the HDLC frame format:
• The HDLC frame begins and ends the error checking procedure with
01111110 in binary. There are three types of HDLC frame types defined by
the control field:
• Information Frames are used for the data transfer between stations. The
send sequence, or next send N(S), and the receive sequence, or next
receive N(R), hold the frame sequence numbers.
• The Poll/Final bit is called Poll when used by the primary station to obtain
a response from a secondary station, and Final when used by the secondary
station to indicate a response or the end of transmission.
• Supervisory Frames are used to acknowledge frames, request for
retransmissions or to ask for suspension of transmission. The Supervisory
code denotes the type of supervisory frame being sent.
• Unnumbered Frames are used for link initialization or link disconnection.
The Unnumbered bits indicate the type of Unnumbered frame being used.

You might also like