0% found this document useful (0 votes)
12 views

Computer Networks Unit 2

Uploaded by

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

Computer Networks Unit 2

Uploaded by

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

Data Link

Control
Unit 2
Introduction
• Data Link Control is the service provided by the
Data Link Layer to provide reliable data transfer
over the physical medium.
• For example, In the half-duplex transmission
mode, one device can only transmit the data
at a time.
• If both the devices at the end of the links
transmit the data simultaneously, they will
collide and leads to the loss of the information.
• The Data link layer provides the coordination
among the devices so that no collision occurs.
Cont..
• The Data link layer provides three functions:
Cont..
Line Discipline
• Line Discipline is a functionality
of the Data link layer that
provides the coordination
among the link systems. It
determines which device can
send, and when it can send
the data.
Line Discipline can be achieved
in two ways:
• ENQ/ACK
(Enquiry/Acknowledgement)
• Poll/select

ENQ/ACK
Cont..
Poll/select
• The Poll/Select method of
line discipline works with
those topologies where
one device is designated
as a primary station, and
other devices are
secondary stations.

•If the primary device wants to send some


data to the secondary device, then it tells the
target secondary to get ready to receive the
data, this process is known as selecting.
Cont..
•If the primary device wants to receive the
data from the secondary device, it asks the
secondary device that they anything to send,
this process is known as polling.

Flow Control
• It is a set of procedures that tells the
sender how much data it can transmit
before the data overwhelms the
receiver.
Two methods have been developed to
control the flow of data:
• Stop-and-wait
• Sliding window
Cont..
Stop and wait
Sender:
• Rule 1) Send one data
packet at a time.
Rule 2) Send the next
packet only after receiving
acknowledgement for the
previous.
Receiver:
• Rule 1) Send
acknowledgement after
receiving and consuming a
data packet.
Rule 2) After consuming
packet acknowledgement
need to be sent (Flow
Control)
Cont..
Framing
• The data link layer encapsulates the packets from
the network layer into frame
• The framing in the data link layer separates a
message from one source to a destination or from
other messages to other destinations just by adding
a sender address and destination address.
• The destination address → where the packet has to
go and the sender address →helps the recipient to
acknowledge.
• By using frames the data can be easily get broken
up into recoverable chunks and in order to check
the corruption in transmission, these chunks can be
checked easily.
Cont..
• The frame fields

2 types of Frames are fixed-size and variable size


• The fixed-size framing, there is no need for defining
the boundaries of the frame. The size or length of
the frame itself can be used as a delimiter.
Cont..
Variable-size framing
• In Variable-size framing, the size of each frame is
different. Thus there is a need of the way in order to
define the end of the frame and the beginning of
the next.
Cont..

Problem:
• This technique was popular when the data was in
the form of text that was exchanged by the data link
layers. The flag selected could be any character that is
not used for text communication. But there is a need to
send other types of information like graphs, audio, and
video.
• Now any pattern that is used for the flag could also be a
part of the Information. If this happens then the receiver
encounters this pattern in the middle of the data and
then thinks that it has reached the end of the frame.
Data-Link Layer
Protocols

Automatic Repeat Request


Cont..
Simplest Protocol
• Simplest protocol is unidirectional,
• There is no acknowledgment (ACK).
• Also, as there is no data loss in the transmission, there is
no need for data re-transmission.
Cont..
• Flow Chart for Simplest Protocol
•There is no error and flow control
mechanism.
•The DLL at the receiving end
immediately removes the frame
header and transfers the data to
the subsequent layer.
Cont..
• Stop and wait protocol Flow Chart for Stop and wait
Protocol

Rule 1: Sender sends one data packet at a time.


Rule 2: Sender sends the next packet only when it
receives the acknowledgment of the previous packet.
Noisy Channel
Cont..
1. Stop and Wait ARQ (Automatic Repeat Request)

• 2 States:
o Ready state
o Blocking State
• Sending Node:
Receives from network
layer save a copy and
there will be a timer
i) If timeout --> resends
ii) Corrupted ack -->
Discards
iii) Error free ack --> Stops
the timer
Cont..
• Receiver Node

Receiving Node:
i) Error free frame --> Deliver
ii)Corrupted frame --> Discards
Cont..
• Flow Chart for Stop
and wait ARQ Protocol
Working of Stop and Wait for
ARQ:
1) Sender A sends a data frame or
packet with sequence number 0.
2) Receiver B, after receiving the
data frame, sends an
acknowledgement with sequence
number 1 (the sequence number of
the next expected data frame or
packet)
There is only a one-bit sequence
number that implies that both
sender and receiver have a buffer for
one frame or packet only.
Cont..
• Difference between Stop and wait (S&W)and S&W AQR)
Cont..
2. Go-Back-N Automatic Repeat Request
• Step 1 − In this protocol we can send several frames before
receiving acknowledgements.
• Step 2 − we keep a copy of these frames until the
acknowledgment arrives.
• Step 3 − Frames from a sending station are numbered
sequentially. However, we need to include the sequence
number of each frame in the header; we need to set a limit.
• Step 4 − If the header of the frame allows m bits for the
sequence number, the sequence numbers range from 0 to
2m-1. We can also repeat the sequence numbers.
Example
• For m = 2, the range of sequence numbers is: 0 to 3, i.e.

0,1,2,3, 0,1,2,3,…
• Problem − Consider a binary
signal sent over 4 KHZ wide
channel, find out the
maximum data rate for
noiseless and a noisy channel
whose signal to noise ratio is
20dB.
Cont..
Selective Repeat ARQ
• Selective repeat protocol, also called Selective Repeat
ARQ (Automatic Repeat reQuest), is a data link layer
protocol that uses sliding window method for reliable
delivery of data frames.
• Here, only the error frame or lost frames are
retransmitted, while the good frames are received and
buffered.
Cont..
Explanation
• Step 1 − Frame 0 sends from sender to receiver and set timer.
• Step 2 − Without waiting for acknowledgement from the receiver
another frame, Frame1 is sent by sender by setting the timer for it.
• Step 3 − In the same way frame2 is also sent to the receiver by
setting the timer without waiting for previous acknowledgement.
• Step 4 − Whenever sender receives the ACK0 from receiver, within
the frame 0 timer then it is closed and sent to the next frame, frame
3.
• Step 5 − whenever the sender receives the ACK1 from the receiver,
within the frame 1 timer then it is closed and sent to the next frame,
frame 4.
• Step 6 − If the sender doesn’t receive the ACK2 from the receiver
within the time slot, it declares timeout for frame 2 and resends the
frame 2 again, because it thought the frame2 may be lost or
damaged.
Cont..
High-level Data Link Control (HDLC)
• High-level Data Link Control (HDLC) is a group of
communication protocols of the data link layer for
transmitting data between network points or nodes.
• It is a bit - oriented protocol
• Transfer Modes
o Normal Response Mode (NRM)
• Point to point Communication
• Multipoint Communication
o Asynchronous Balanced Mode (ABM)

•Normal Response Mode (NRM) −


Here, two types of stations are there, a
primary station that send commands
and secondary station that can respond
to received commands. It is used for
both point - to - point and multipoint
communications.
Cont..
• Asynchronous Balanced Mode (ABM) − Here, the
configuration is balanced, The link is point-to-point,
and each station can function as a primary and a
secondary (acting as peers).
Cont..
HDLC 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 −
• The flag field is generally responsible for the initiation and termination of error checking.
• 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 (Frame Check Sequence) − It is a 2 byte or 4 bytes frame check sequence for
error detection. The standard code used is CRC (cyclic redundancy
code)
Cont..
Types of HDLC Frames
• There are three types of HDLC frames. The type of
frame is determined by the control field of the frame

• I-frame − I-frames or Information frames carry user
data from the network layer. They also include flow
and error control information that is piggybacked on
user data. The first bit of control field of I-frame is 0.
Cont..
• S-frame − S-frames or Supervisory frames do not
contain information field. They are used for flow and
error control when piggybacking is not required. The
first two bits of control field of S-frame is 10.

• U-frame − U-frames or Un-numbered frames are used


for countless miscellaneous functions, like link
management. It may contain an information field, if
required. The first two bits of control field of U-frame is
11.
Point to Point Protocol (PPP)
• Point - to - Point Protocol (PPP) is a communication
protocol of the data link layer that is used to transmit
multiprotocol data between two directly connected (point-
to-point) computers.
• It is a byte - oriented protocol that is widely used in
broadband communications having heavy loads and high
speeds.
• No flow control
Services Provided by PPP
•Defining the frame format of the data
to be transmitted.
•Defining the procedure of establishing •Stating authentication rules of the
link between two points and exchange communicating devices.
of data. •Providing address for network
•Stating the method of encapsulation communication.
(adding additional information) of •Providing connections over multiple
network layer data in the frame. links.
Cont..
Components of PPP
• Link Control Protocol (LCP) − It is responsible for
establishing, configuring, testing, maintaining and
terminating links for transmission.
• Authentication Protocols (AP) − These protocols
authenticate endpoints for use of services.
• Password Authentication Protocol (PAP)
• Challenge Handshake Authentication Protocol (CHAP)
• Network Control Protocols (NCPs) − These protocols
are used for negotiating the parameters and facilities
for the network layer. Some of the NCPs of PPP are
• Internet Protocol Control Protocol (IPCP)
• OSI Network Layer Control Protocol (OSINLCP)
• Internetwork Packet Exchange Control Protocol (IPXCP)
• IPv6 Control Protocol (IPV6CP)
Cont..
PPP Frame
• PPP is a byte - oriented protocol where each field of the frame is
composed of one or more bytes. The fields of a PPP frame are −
• Flag − 1 byte that marks the beginning and the end of the frame.
The bit pattern of the flag is 01111110.
• Address − 1 byte which is set to 11111111 in case of broadcast.
• Control − 1 byte set to a constant value of 11000000.
• Protocol − 1 or 2 bytes that define, It can either be user information or
other information.
• Payload − This carries the data from the network layer. The
maximum length of the payload field is 1500 bytes. This can also be
negotiated between the endpoints of communication.
• FCS − It is a 2 byte or 4 bytes frame check sequence for error
detection. The standard code used is CRC (cyclic redundancy code)
Cont..
• Transition Phases in the PPP Protocol
1. Dead: Link basically starts and stops

Failed
Medium Access Control
(MAC)
• A media access control is a network data transfer policy
that determines how data is transmitted between two
computer terminals through a network cable.
• The Data Link Layer is responsible for transmission of data
between two nodes. Its main functions are-

• DLC is responsible for reliable transmission of • MAR/MAC are required to


message over transmission channel by using decrease collision and avoid
techniques like framing, error control and crosstalk.
flow control. • Multiple nodes
• Point to Point
Cont..
• Carrier-sense multiple access (CSMA)
• Carrier-sense multiple access with collision
detection (CSMA/CD)
• Carrier-sense multiple access with collision
avoidance (CSMA/CA)
• Frequency Division Multiple Access (FDMA)
• Time-division multiple access (TDMA)
• Code-division multiple access (CDMA)
ALOHA
Aloha is a Random-Access Protocol
• In this protocol, all the station has the equal priority to
send the data over a channel.
• Here, one or more stations cannot depend on another
station nor any station control another station.
• Depending on the channel's state (idle or busy), each
station transmits the data frame.
• However, if more than one station sends the data over a
channel, there may be a collision or data conflict.
• Due to the collision, the data frame packets may be lost or
changed. And hence, it does not receive by the receiver
end.
Cont..
• Pure ALOHA
Cont..

Length of time in which there is a possibility of


collision is called Vulnerable time
Cont..
• Slotted ALOHA
Cont..
Carrier Sense Multiple
Access (CSMA)
• To minimize the chance of collision and, therefore,
increase the performance.
• Principle of CSMA:"Sense before transmit"
• Carrier busy-Transmission is taking place
• Carrier idle-No transmission currently taken place
Cont..
Types of CSMA:
• 1-persistent
• Non-persistent
• P-persistent
Cont..
• CSMA Types and Access Modes
• 1-Persistent: In the 1-Persistent mode of CSMA that
defines each node, first sense the shared channel and if the
channel is idle, it immediately sends the data. Else it must
wait and keep track of the status of the channel to be idle
and broadcast the frame unconditionally as soon as the
channel is idle.
• Non-Persistent: It is the access mode of CSMA that defines
before transmitting the data, each node must sense the
channel, and if the channel is inactive, it immediately sends
the data. Otherwise, the station must wait for a random
time (not continuously), and when the channel is found to
be idle, it transmits the frames.
Cont..
• P-Persistent: It is the combination of 1-Persistent and Non-
persistent modes. The P-Persistent mode defines that each
node senses the channel, and if the channel is inactive, it
sends a frame with a P probability. If the data is not
transmitted, it waits for a (q = 1-p probability) random time
and resumes the frame with the next time slot.
CSMA/CD (Collision
Detection)
• CSMA/CD is a media access control method that was widely
used in Early Ethernet technology(It is used in 802.3 Ethernet
network cable)/LANs when there used to be shared Bus
Topology and each node ( Computers) were connected By
Coaxial Cables.
• CSMA/CD is one such technique where different stations that
follow this protocol agree on some terms and collision
detection measures for effective transmission.
• This protocol decides which station will transmit when so that
data reaches the destination without corruption.
Cont..
How CSMA/CD works?
• Step 1: Check if the sender is ready for transmitting data packets.
• Step 2: Check if the transmission link is idle?
o keep on checking….
o Sender sends dummy data on the link

• Step 3: Transmit the data & check for collisions.


o CSMA/CD does not use an ‘acknowledgment’ system.
o It checks for successful and unsuccessful transmissions through collision signals.

• Step 4: If no collision was detected in propagation, the sender


completes its frame transmission and resets the counters.
Cont
Cont..

Maximum
15
retransmit
can do
CSMA/CA (Collision
Avoidance)
• It means that it is a network protocol that is used to avoid a
collision rather than allowing it to occur.
• Collisions are avoided using 3 CSMA/CA strategies

-Inter-frame space (IFS)


-Contention Window
IFS means
-Acknowledgement wait for
period of
Slot time
• CSMA/CA
Flow Diagram
Reservation
• Whenever we travel from a train or an airplane, the first
thing we do is to reserve our seats, similarly here a station
must make a reservation first before transmitting any data-
frames.
• This reservation in Computer Network timeline consists of
two kinds of periods: If there are M stations, the reservation
interval is divided into M slots, and
1. Reservation interval of a fixed time duration each station has one slot.
2. Data transmission period of variable frames

Minislot
Polling
Cont..
Cont..
2 function of polling
1.Poll function: if the primary wants to receive data, it
asks the secondaries if they have anything to send.
2. Select function: If the primary wants to send data, it
tells the secondary to get ready to receive
We calculate the efficiency of this method in terms of time for
polling & time required for transmission of data.
o T = time for polling
poll

o Tt = time required for transmission of data


o So, efficiency = Tt / (Tt + T )poll
Cont..
if primary station wants to send data to the secondary
stations, it sends a select message, and if the secondary
station accepts the request from the primary station, then
Poll function it sends back an acknowledgement and then primary
station transmits the data and in return receives an
acknowledgement.
Select function
Token Passing

(when ever station holding token it can send the


data)

Disadvantage: If any one node fails it will crash entire the network
Cont..
The nodes which hold the
token can send the data

The token circulation around the table (or a


network ring) is in a predefined order.
Cont..
Performance of Token Passing

• Throughput, which is a measure of the


successful traffic.
• What is Propagation and Transmission
delay
Frequency Division
Multiple Access (FDMA)
• FDMA is a type of channelization protocol.
• In this bandwidth is divided into various frequency bands.
• Each station is allocated with band to send data and that
band is reserved for particular station for all the time
Frequency Band sending unused frequency bands are
data called as guard bands
Station 1

Station 2

Station 3
Time Division Multiple
Access (TDMA)
• TDMA is the channelization protocol in which bandwidth of
channel is divided into various stations on the time basis.
• There is a time slot given to each station, the station can
transmit data during that time slot

Each station must aware of


its beginning of time slot
and the location of the time
slot.

Gap between 2 time


slot is Guard time
Code Division Multiple
Access (CDMA)
• In CDMA, all the stations can
transmit data simultaneously.
• It allows each station to transmit
data over the entire frequency all
the time.
• Multiple simultaneous transmissions
are separated by unique code
sequence.
• Each user is assigned with a unique
code sequence.
4 stations marked as 1, 2, 3 and 4.
Data assigned with respective stations as d1, d2, d3 and
d4
Code assigned with respective stations as c1, c2, c3 and
c4.

You might also like