0% found this document useful (0 votes)
4 views121 pages

1.unit-2 DCCN

Uploaded by

vardanvishnu135
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)
4 views121 pages

1.unit-2 DCCN

Uploaded by

vardanvishnu135
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/ 121

UNIT - II

Data link layer: Introduction, Framing, and Error –


Detection and Correction – Parity – LRC – CRC
Hamming code, Flow and Error Control, Noiseless
Channels, Noisy Channels, HDLC, Point to Point
Protocols. 111 Medium Access sub layer: ALOHA,
CSMA/CD, LAN – Ethernet IEEE 802.3, IEEE 802.5
– IEEE 802.11, Random access, Controlled access,
Channelization.
Basic Introduction
• In the OSI model, the data link layer is a 6th layer
from the top and 2nd layer from the bottom.
• Networks must be able to transfer data from one
device to another with complete accuracy.
• For reliable communication, errors must be
detected and corrected.
• Error detection and correction are
implemented either at the data link layer or
the transport layer of the OSI model.
Error
A condition when the receiver’s information does
not match with the sender’s information. During
transmission, digital signals suffer from noise that
can introduce errors in the binary bits travelling
from sender to receiver.
That means a 0 bit may change to 1 or a 1 bit may
change to 0.
Types Of Errors
Errors can be classified into two categories:
•Single-Bit Error
•Burst Error
Single-bit error

In the received frame, only one bit has been


corrupted, i.e. either changed from 0 to 1 or from
1 to 0.
Burst error
 The term burst error means that two or more bits in the data
unit have changed from 1 to 0 or from 0 to 1.
To detect or correct errors, we need to send extra
(redundant) bits with data.
Error detection vs Error correction
Error Detection Techniques
• Some popular techniques for error detection are:
1. Simple Parity check (Vertical Redundancy Check- VRC)
2. Two-dimensional Parity check (Longitudinal Redundancy
Check -LRC)
3. Checksum
4. Cyclic redundancy check-CRC
1. Simple Parity check
Blocks of data from the source are subjected to a check
bit or parity bit generator form, where a parity of :
• 1 is added to the block if it contains odd number of 1’s,
and
• 0 is added if it contains even number of 1’s
• This scheme makes the total number of 1’s even, that is
why it is called even parity checking.
• Simple Parity check is also known as Vertical
Redundancy Check (VRC)
1. Simple Parity check
2. Two-dimensional Parity check
• Parity check bits are calculated for each row, which
is equivalent to a simple parity check bit.
• Two-dimensional Parity check is also known as
Longitudinal Redundancy Check (LRC)
• Parity check bits are also calculated for all columns,
then both are sent along with the data. At the
receiving end these are compared with the parity
bits calculated on the received data.
2. Two-dimensional Parity check
3. Checksum
• In checksum error detection scheme, the data is divided into k
segments each of m bits.
• In the sender’s end the segments are added using 1’s
complement arithmetic to get the sum. The sum is
complemented to get the checksum.
• The checksum segment is sent along with the data segments.
• At the receiver’s end, all received segments are added using 1’s
complement arithmetic to get the sum. The sum is
complemented.
• If the result is zero, the received data is accepted; otherwise
discarded.
3. Checksum
4. 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.
• A remainder indicates that the data unit has been damaged in
transit and therefore must be rejected.
Following are the steps used in CRC for error detection:
• In CRC technique, a string of n 0s is appended to the data unit, and
this n number is less than the number of bits in a predetermined
number, known as division which is n+1 bits.
• Secondly, the newly extended data is divided by a divisor using a
process is known as binary division. The remainder generated
from this division is known as CRC remainder.
• Thirdly, the CRC remainder replaces the appended 0s at the end of
the original data. This newly generated unit is sent to the receiver.
• The receiver receives the data followed by the CRC remainder. The
receiver will treat this whole unit as a single unit, and it is divided
by the same divisor that was used to find the CRC remainder.
4. Cyclic redundancy check (CRC)
Figure : XORing of two single bits or two words
Example : (CRC)
Division in the CRC decoder for two cases
Hamming Code
• Hamming code is a set of error-correction codes that can
be used to detect and correct the errors that can occur
when the data is moved or stored from the sender to the
receiver.
• It is technique developed by R.W. Hamming for error
correction.
• Redundant bits are extra binary bits that are generated
and added to the information-carrying bits of data
transfer to ensure that no bits were lost during the data
transfer.
General Algorithm of Hamming code
The Hamming Code is simply the use of extra parity
bits(p) or Redundant bits(r) to allow the
identification of an error.
1. Write the bit positions starting from 1 in binary
form (1, 10, 11, 100, etc).
2. All the bit positions that are a power of 2 are
marked as parity bits (1, 2, 4, 8, etc).
3. All the other bit positions are marked as data bits.
Checking the parity bits
• For P1 : Check the locations 1, 3, 5, 7, 9. There is three 1s in this group,
which is wrong for even parity. Hence the bit value for P1 is 1.
• For P2 : Check the locations 2, 3, 6, 7. There is one 1 in this group,
which is wrong for even parity. Hence the bit value for P2 is 1.
• For P3 : Check the locations 3, 5, 6, 7. There is one 1 in this group,
which is wrong for even parity. Hence the bit value for P3 is 1.
• For P4 : Check the locations 8, 9. There are two 1s in this group, which
is correct for even parity. Hence the bit value for P4 is 0.
• The resultant binary word is 0111. It corresponds to the bit location 7 in
the above table. The error is detected in the data bit D4. The error is 0
and it should be changed to 1. Thus the corrected code is 111001101.
FLOW AND ERROR CONTROL
• Data communication requires at least two devices
working together, one to send and the other to
receive.
• The most important responsibilities of the data link
layer are flow control and error control. Collectively,
these functions are known as data link control.
Flow Control
• In most protocols, flow control is a set of procedures that tells
the sender how much data it can transmit before it must wait
for an acknowledgment from the receiver.
• The flow of data must not be allowed to overwhelm the
receiver. Any receiving device has a limited speed at which it
can process incoming data and a limited amount of memory in
which to store incoming data.
• The receiving device must be able to inform the sending device
before those limits are reached and to request that the
transmitting device send fewer frames or stop temporarily.
Stop and Wait
• This protocol involves the following transitions −
• The sender sends a frame and waits for
acknowledgment.
• Once the receiver receives the frame, it sends an
acknowledgment frame back to the sender.
• On receiving the acknowledgment frame, the sender
understands that the receiver is ready to accept the
next frame. So it sender the next frame in queue.
Sliding Window
• This protocol improves the efficiency of stop and wait protocol by
allowing multiple frames to be transmitted before receiving an
acknowledgment.
The working principle of this protocol can be described as follows :
• Both the sender and the receiver has finite sized buffers called
windows. The sender and the receiver agrees upon the number of
frames to be sent based upon the buffer size.
• The sender sends multiple frames in a sequence, without waiting for
acknowledgment. When its sending window is filled, it waits for
acknowledgment. On receiving acknowledgment, it advances the
window and transmits the next frames, according to the number of
acknowledgments received.
Sliding Window Protocol
• The sliding window is a technique for sending multiple frames at a
time. It controls the data packets between the two devices where
reliable and gradual delivery of data frames is needed.
• In this technique, each frame has sent from the sequence number.
The sequence numbers are used to find the missing data in the
receiver end. The purpose of the sliding window technique is to
avoid duplicate data, so it uses the sequence number.

Sliding window protocol has two types:


• Go-Back-N ARQ
• Selective Repeat ARQ
Go-Back-N ARQ protocol
• 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.
Go-Back-N ARQ protocol
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.
Selective Repeat ARQ
Difference between the Go-Back-N ARQ and Selective Repeat ARQ?
HDLC- Topics
HDLC- Topics
• What is HDLC
• Three stations
• Transfer Modes in HDLC (Normal Response Mode(NRM),
Asynchronous Balance Mode(ABM))

• HDLC Frames (I , S , U - Frames)


• HDLC Frame Format (6 fields in a frame)
High-Level Data Link Control (HDLC)
• HDLC (High-Level Data Link Control) is a bit-oriented
protocol that is used for communication over
the point-to-point and multipoint links.
• HDLC includes mainly six fields
Transfer Modes in HDLC
• The HDLC protocol offers two modes of transfer that
mainly can be used in different configurations.
These are as follows:
• Normal Response Mode(NRM)
• Asynchronous Balance Mode(ABM)
Normal Response Mode (NRM)
• 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.
Asynchronous Balanced Mode (ABM)
• Asynchronous Balanced Mode (ABM) − Here, the
configuration is balanced, i.e. each station can both
send commands and respond to commands. It is
used for only point - to - point communications.
HDLC Frame Format
HDLC Frames
HDLC Frames
• IThere are three types of frames defined in the HDLC:
• Information Frames(I-frames) These frames are used to transport
the user data and the control information that is related to the
user data. If the first bit of the control field is 0 then it is identified
as I-frame.
• Supervisory Frames(S-frames) These frames are only used to
transport the control information. If the first two bits of the control
field are 1 and 0 then the frame is identified as S-frame
• Unnumbered Frames(U-Frames) These frames are mainly reserved
for system management. These frames are used for exchanging
control information between the communicating devices.
HDLC Frame Format
• There are up to six fields in each HDLC frame. There is a beginning flag
field, the address field then, a control field, an information field, a
frame check sequence field(FCS), and an ending field.
1. Flag Field
• This field of the HDLC frame is mainly a sequence of 8-bit having the
bit pattern 01111110 and it is used to identify the beginning and end
of the frame. The flag field mainly serves as a synchronization pattern
for the receiver.
2. Address Field
• It is the second field of the HDLC frame and it mainly contains the
address of the secondary station. This field can be 1 byte or several
bytes long which mainly depends upon the need of the network.
3. Control Field
• This is the third field of the HDLC frame and it is a 1 or 2-byte segment
of the frame and is mainly used for flow control and error control. Bits
interpretation in this field mainly depends upon the type of the frame.
4. Information Field
• This field of the HDLC frame contains the user's data from the network
layer or the management information. The length of this field varies
from one network to another.
5. FCS Field
• FCS means Frame check sequence and it is the error detection field in
the HDLC protocol. There is a 16 bit CRC code for error detection.
Point-to-Point Protocol- Sub Topics
• What is Point-to-Point Protocol (PPP)
• Services provided by PPP
• Services not provided by PPP
• Frame format of PPP protocol
• Transition phases of PPP protocol
Point-to-Point Protocol
• PPP(Point-To-Point) protocol is a protocol used in the
data link layer. The PPP protocol is mainly used to
establish a direct connection between two nodes.
• It is the most commonly used protocol for point-to-
point access. Suppose the user wants to access the
internet from the home, the PPP protocol will be used.
• It is a byte - oriented protocol that is widely used in
broadband communications having heavy loads and
high speeds.
Services provided by PPP
• This protocol defines how two devices can authenticate
with each other.
• PPP protocol also defines the format of the frames that
are to be exchanged between the devices.
• This protocol also defines how the data of the network
layer are encapsulated in the data link frame.
• This protocol provides multiple services of the network
layer and also supports various network-layer protocols.
• This protocol also provides connection over multiple links.
Services Not provided by the PPP protocol
• It does not support flow control mechanism.
• It has a very simple error control mechanism.
• As PPP provides point-to-point communication, so it
lacks addressing mechanism to handle frames in
multipoint configuration.
Frame format of PPP protocol
Frame format of PPP protocol
• Flag: The flag field is used to indicate the start and end of the frame. The flag field
is a 1-byte field that appears at the beginning and the ending of the frame. The
pattern of the flag is similar to the bit pattern in HDLC, i.e., 01111110.
• Address: It is a 1-byte field that contains the constant value which is 11111111.
(These 8 ones represent a broadcast address).
• Control: It is a 1-byte field which is set through the constant value, i.e., 11000000.
It is not a required field as PPP does not support the flow control and a very limited
error control mechanism.
• Protocol: It is a 1 or 2 bytes field that defines what is to be carried in the data field.
The data can be a user data or other information.
• Payload: The payload field carries either user data or other information. The
maximum length of the payload field is 1500 bytes.
• Checksum: It is a 16-bit field which is generally used for error detection.
Transition phases of PPP protocol
Transition phases of PPP protocol (Cont..)
Dead: Dead is a transition phase which means that the link is not used
or there is no active carrier at the physical layer.
Establish: If one of the nodes starts working then the phase goes to the
establish phase. In short, we can say that when the node starts
communication or carrier is detected then it moves from the dead to
the establish phase.
Authenticate: It is an optional phase which means that the
communication can also moves to the authenticate phase. The phase
moves from the establish to the authenticate phase only when both
the communicating nodes agree to make the communication
authenticated.
Transition phases of PPP protocol (Cont..)
Network: Once the authentication is successful, the network is
established or phase is network. In this phase, the negotiation of
network layer protocols take place.
Open: After the establishment of the network phase, it moves to the
open phase. Here open phase means that the exchange of data takes
place. Or we can say that it reaches to the open phase after the
configuration of the network layer.
Terminate: When all the work is done then the connection gets
terminated, and it moves to the terminate phase.
On reaching the terminate phase, the link moves to the dead phase
which indicates that the carrier is dropped which was earlier created.
Part -2
• multiple access protocols are required to decrease
collision and avoid crosstalk.
Multiple access protocol
• When a sender and receiver have a dedicated link to
transmit data packets, the data link control is enough to
handle the channel. Suppose there is no dedicated path
to communicate or transfer the data between two
devices.
• In that case, multiple stations access the channel and
simultaneously transmits the data over the channel. It
may create collision and cross talk. Hence, the multiple
access protocol is required to reduce the collision and
avoid crosstalk between the channels.
1. Random Access Protocol:
• In this protocol, all the station has the equal priority to send
the data over a channel. In random access protocol, 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.
Random Access protocol
• The random-access protocol is further divided into
four categories, which are:
I. Aloha
II. CSMA
III. CSMA/CD
IV. CSMA/CA
Aloha Rules
• Any station can transmit data to a channel at any time.
• It does not require any carrier sensing.
• Collision and data frames may be lost during the transmission of data
through multiple stations.
• It requires retransmission of data after some random amount of time.
Pure Aloha
Slotted Aloha
• The slotted Aloha is designed to overcome the pure Aloha's efficiency
because pure Aloha has a very high possibility of frame hitting.
• In slotted Aloha, the shared channel is divided into a fixed time
interval called slots.
• So that, if a station wants to send a frame to a shared channel, the
frame can only be sent at the beginning of the slot, and only one
frame is allowed to be sent to each slot. And if the stations are
unable to send data to the beginning of the slot, the station will have
to wait until the beginning of the slot for the next time. However, the
possibility of a collision remains when trying to send a frame at the
beginning of two or more station time slot.
CSMA (Carrier Sense Multiple Access)
• It is a carrier sense multiple access based on media access
protocol to sense the traffic on a channel (idle or busy)
before transmitting the data. It means that if the channel is
idle, the station can send data to the channel. Otherwise, it
must wait until the channel becomes idle. Hence, it reduces
the chances of a collision on a transmission medium.
• CSMA is a mechanism that senses the state of the shared
channel to prevent or recover data packets from a collision.
• The persistence methods can be applied to help the station
take action when the channel is busy/idle.
CSMA access modes
• 1-persistent: The node senses the channel, if idle it sends the data,
otherwise it continuously keeps on checking the medium for being
idle and transmits unconditionally(with 1 probability) as soon as the
channel gets idle.
• Non-Persistent: The node senses the channel, if idle it sends the
data, otherwise it checks the medium after a random amount of time
(not continuously) and transmits when found idle.
• P-Persistent: The node senses the medium, if idle it sends the data
with p probability. If the data is not transmitted ((1-p) probability)
then it waits for some time and checks the medium again, now if it is
found idle then it send with p probability. This repeat continues until
the frame is sent. It is used in Wifi and packet radio systems.
CSMA/CD
• Carrier sense multiple access with Collision
Detection. The process of collisions detection
involves sender receiving acknowledgement signals.
If there is just one signal(its own) then the data is
successfully sent but if there are two signals(its own
and the one with which it has collided) then it
means a collision has occurred.
Advantages & Dis-Adv of CSMA CD:
• It is used for collision detection on a shared channel within a very short
time.
• CSMA CD is better than CSMA for collision detection.
• CSMA CD is used to avoid any form of waste transmission.
• It has lower CSMA CD overhead as compared
Dis-Adv of CSMA CD:
• It can detect collision only up to 2500 meters, and beyond this range, it
cannot detect collisions.
• It is not suitable for long-distance networks because as the distance
increases, CSMA CD' efficiency decreases.
• When multiple devices are added to a CSMA CD, collision detection
performance is reduced.
CSMA/ CA
• It is a carrier sense multiple access/collision avoidance network
protocol for carrier transmission of data frames.
• It is a protocol that works with a medium access control layer.
When a data frame is sent to a channel, it receives an
acknowledgment to check whether the channel is clear.
• If the station receives only a single (own) acknowledgments, that
means the data frame has been successfully transmitted to the
receiver. But if it gets two signals (its own and one more in which
the collision of frames), a collision of the frame occurs in the
shared channel. Detects the collision of the frame when a sender
receives an acknowledgment signal.
CSMA/ CA
• following are the methods used in the CSMA/ CA to avoid the
• Interframe space: In this method, the station waits for the channel to become idle,
and if it gets the channel is idle, it does not immediately send the data. Instead of
this, it waits for some time, and this time period is called the Interframe space or
IFS. However, the IFS time is often used to define the priority of the station.
• Contention window: In the Contention window, the total time is divided into
different slots. When the station/ sender is ready to transmit the data frame, it
chooses a random slot number of slots as wait time. If the channel is still busy, it
does not restart the entire process, except that it restarts the timer only to send
data packets when the channel is inactive.
• Acknowledgment: In the acknowledgment method, the sender station sends the
data frame to the shared channel if the acknowledgment is not received ahead of
time.
• collision:
Advantage of CSMA CA
• When the size of data packets is large, the chances of collision in CSMA
CA is less.
• It controls the data packets and sends the data when the receiver
wants to send them.
• CSMA CA avoids wasted transmission of data over the channel.
• It is best suited for wireless transmission in a network.
The disadvantage of CSMA CA
• Sometime CSMA/CA takes much waiting time as usual to transmit the
data packet.
• It consumes more bandwidth by each station.
• Its efficiency is less than a CSMA CD.
Difference between CSMA CA and CSMA CD
Controlled-access Protocol
• In controlled access, the stations seek information
from one another to find which station has the right
to send. It allows only one node to send at a time,
to avoid collision of messages on shared medium.
The three controlled-access methods are:
• Reservation
• Polling
• Token Passing
Reservation
• In the reservation method, a station needs to make a reservation before
sending data.
• The time line has two kinds of periods:
– Reservation interval of fixed time length
– Data transmission period of variable frames.
• If there are M stations, the reservation interval is divided into M slots,
and each station has one slot.
• Suppose if station 1 has a frame to send, it transmits 1 bit during the slot
1. No other station is allowed to transmit during this slot.
• After data transmission period, next reservation interval begins.
• Since everyone agrees on who goes next, there will never be any
collisions.
Polling process – Election
Polling
Polling
• The polling method mainly works with those topologies where one
device is designated as the primary station and the other device is
designated as the secondary station.
• All data exchanges must be made
• through the primary device even when the ultimate destination is a
secondary device.
• The primary device controls the link; the secondary devices follow its
instructions
• If the primary wants to receive data, it asks the secondaries if they have
anything to send; this is called poll function. If the primary wants to
send data, it tells the secondary to get ready to receive; this is called
select function.
Polling
•There is a poll function that is mainly used by the primary devices in order to
solicit transmissions from the secondary devices.
•When the primary device is ready to receive the data then it must ask(poll) each
secondary device in turn if it has anything to send.
•If the secondary device has data to transmit then it sends the data frame,
otherwise, it sends a negative acknowledgment (NAK).
Token Passing
• In the token passing methods, all the stations are organized in the
form of a logical ring. We can also say that for each station there is a
predecessor and a successor.
• The predecessor is the station that is logically before the station in the
ring; while the successor is the station that is after the station in the
ring. The station that is accessing the channel now is the current
station.
• Basically, a special bit pattern or a small message that circulates from
one station to the next station in some predefined order is commonly
known as a token.
• Possessing the token mainly gives the station the right to access the
channel and to send its data.
Token Passing
• In Token ring, token is passed from one station to
another adjacent station in the ring whereas incase
of Token bus, each stationuses the bus to send the
token to the next station in some predefined order.
• In both cases, token represents permission to send.
Token Passing
Ethernet
• Wired LANs: Ethernet
• IEEE stands for Institute of Electrical and
Electronics Engineers.
Frame Format of Ethernet and IEEE 802.3
Frame Format of Ethernet and IEEE 802.3
• Preamble: It is the starting field that provides alert and timing pulse for transmission. In
case of classic Ethernet it is an 8 byte field and in case of IEEE 802.3 it is of 7 bytes.
• Start of Frame Delimiter: It is a 1 byte field in a IEEE 802.3 frame that contains an
alternating pattern of ones and zeros ending with two ones.
• Destination Address: It is a 6 byte field containing physical address of destination
stations.
• Source Address: It is a 6 byte field containing the physical address of the sending station.
• Length: It a 7 bytes field that stores the number of bytes in the data field.
• Data: This is a variable sized field carries the data from the upper layers. The maximum
size of data field is 1500 bytes.
• Padding: This is added to the data to bring its length to the minimum requirement of 46
bytes.
• CRC: CRC stands for cyclic redundancy check. It contains the error detection information.
What is Ethernet?
• Ethernet is the most widely used LAN technology, which is
defined under IEEE standards 802.3. The reason behind its wide
usability is Ethernet is easy to understand, implement, maintain,
and allows low-cost network implementation.
• Also, Ethernet offers flexibility in terms of topologies that are
allowed. Ethernet generally uses Bus Topology. Ethernet
operates in two layers of the OSI model, Physical Layer, and Data
Link Layer.
• For Ethernet, the protocol data unit is Frame since we mainly
deal with DLL. In order to handle collision, the Access control
mechanism used in Ethernet is CSMA/CD.

You might also like