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

Module 4 Data Link Layer

Uploaded by

fathima
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Module 4 Data Link Layer

Uploaded by

fathima
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 106

Module 4

DATA LINK LAYER


CONTENTS
• Introduction
• Framing
• Error detection methods-Parity check,CRC,Checksum
INTRODUCTION
• deals with procedures for communication between two adjacent
nodes—node-to-node communication.
• Data link control (DLC) functions include
• Framing
• flow and error Control
• error detection and correction.
FRAMING
• Data transmission in the physical layer means moving bits in the form
of a signal from the source to the destination.

• The data-link layer, on the other hand, needs to pack bits into frames,
so that each frame is distinguishable from another

• Framing in the data-link layer separates a message from one source to


a destination by adding a sender address and a destination address.
Character-Oriented Framing

• In character-oriented (or byte-oriented) framing, data to be carried are 8-bit characters


• The header which carries the source and destination addresses and other control information, and
the trailer, which carries error detection redundant bits, are also multiples of 8 bits.
• To separate one frame from the next, an 8-bit (1-byte) flag is added at the beginning and the
• end of a frame.
• The flag, composed of protocol-dependent special characters, signals the start or end of a frame.
• Character-oriented framing was used when only text was exchanged by the data-link layers.
Byte stuffing

• Byte stuffing is the process of adding one extra byte whenever there is
a flag or escape character in the text
• In byte stuffing (or character stuffing), a special byte is added to the
data section of the frame when there is a character with the same
pattern as the flag.
• The data section is stuffed with an extra byte.
• This byte is usually called the escape character (ESC) and has a
predefined bit pattern.
• Whenever the receiver encounters the ESC character, it removes it
from the data section and treats the next character as data, not as a
delimiting flag.
Bit-Oriented Framing

• In addition to headers (and possible trailers), we still need a delimiter


to separate one frame from the other.
• Most protocols use a special 8-bit pattern flag, 01111110, as the
delimiter to define the beginning and the end of the frame
This flag can create the same type of problem we saw in the character-oriented protocols. That is, if the flag
pattern appears in the data, we need to somehow inform the receiver that this is not the end of the frame.
We do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern from looking like a flag. The
strategy is called 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.
• A parity-check code can detect
an odd number of errors
Cyclic Codes
• In a cyclic code, if a codeword is cyclically shifted (rotated), the result
is another codeword.
• For example, if 1011000 is a codeword and we cyclically left-shift,
then 0110001 is also a codeword.
• In this case, if we call the bits in the first word a0 to a6, and the bits in
the second word
• b0 to b6, we can shift the bits by using the following:
• b1 = a0 b2 = a1 b3 = a2 b4 = a3 b5 = a4 b6 = a5 b0 = a6
Cyclic Redundancy Check [https://www.youtube.com/watch?v=-oUrtqvUA2o ]
• We can create cyclic codes to correct errors.
• A type of cyclic codes called the cyclic redundancy check (CRC) that
is used in networks such as LANs and WANs.
Steps
• dataword has k bits (4 here);
• the codeword has n bits (7 here).
• The size of the dataword is augmented by adding n − k (3 here) 0s to the right-hand side
• of the word.
• The n-bit result is fed into the generator.
• The generator uses a divisor of size n − k + 1 (4 here), predefined and agreed upon.
• The generator divides the augmented dataword by the divisor (modulo-2 division).
• The quotient of the division is discarded;
• the remainder (r2r1r0) is appended to the dataword to create the codeword.
• The decoder receives the codeword (possibly corrupted in transition).
• A copy of all n bits is fed to the checker, which is a replica of the generator.
• The remainder produced by the checker is a syndrome of n − k (3 here) bits, which is fed to the
decision logic analyzer. The analyzer has a simple function. If the syndrome bits are all 0s, the 4
leftmost bits of the codeword are accepted as the dataword (interpreted as no error);
• otherwise, the 4 bits are discarded (error).
Sender
Reciver
Checksum
• Checksum is an error-detecting technique that can be applied to a
message of any length.
• In the Internet, the checksum technique is mostly used at the network
and transport layer rather than the data-link layer
• At the source, the message is first divided into m-bit units.
• The generator then creates an extra m-bit unit called the checksum,
which is sent with the message.
• At the destination, the checker creates a new checksum from the
combination of the message and sent checksum.
• If the new checksum is all 0s, the message is accepted; otherwise, the
message is discarded .
• Note that in the real implementation, the checksum unit is not
necessarily added at the end of the message; it can be inserted in the
middle of the message.
Traditional checksum

• Suppose the message is a list of five 4-bit numbers that we want to


send to a destination. In addition to sending these numbers, we send
the sum of the numbers. For example, if the set of numbers is (7, 11,
12, 0, 6), we send (7, 11, 12, 0, 6, 36), where 36 is the sum of the
original numbers. The receiver adds the five numbers and compares
the result with the sum. If the two are the same, the receiver assumes
no error, accepts the five numbers, and discards the sum. Otherwise,
there is an error somewhere and the message not accepted
One’s Complement Addition [https://www.youtube.com/watch?
v=AtVWnyDDaDI]
Multiple access protocols
(collision and token based)
• data-link layer is divided into two sublayers:
• data link control (DLC)
• media access control (MAC).
• When nodes or stations are connected and use a common link, called a multipoint
or broadcast link, we need a multiple-access protocol to coordinate access to the
link
HOME WORK [SOLUTION:PAGE:434-435
• A slotted ALOHA network transmits 200-bit frames using a shared
channel with a 200-kbps
• bandwidth. Find the throughput if the system (all stations together)
produces
• a. 1000 frames per second.
• b. 500 frames per second.
• c. 250 frames per second.
CSMA
• Carrier sense multiple access (CSMA) requires that each station first listen to the
medium (or check the state of the medium) before sending.
• The station is required to first sense the medium (for idle or busy) before transmitting
data.
• If it is idle then it sends data
• otherwise it waits till the channel becomes idle.
• However there is still chance of collision in CSMA due to propagation delay.
• For example, if station A wants to send data, it will first sense the medium.If it finds
the channel idle, it will start sending data. However, by the time the first bit of data is
transmitted (delayed due to propagation delay) from station A, if station B requests to
send data and senses the medium it will also find it idle and will also send data. This
will result in collision of data from station A and B.
Persistence Methods
Contention Protocols (Cont’d)
• CSMA (Carrier Sense Multiple Access)
• Improvement: Start transmission only if no transmission is ongoing
• CSMA/CD (CSMA with Collision Detection)
• Improvement: Stop ongoing transmission if a collision is detected
• CSMA/CA (CSMA with Collision Avoidance)
• Improvement: Wait a random time and try again when carrier is
quiet. If still quiet, then transmit
• CSMA/CA with ACK
• CSMA/CA with RTS/CTS

45
CSMA/CD (CSMA with Collision Detection)

• In CSMA, if 2 terminals begin sending packet at the same


time, each will transmit its complete packet (although
collision is taking place).
• Wasting medium for an entire packet time.
• CSMA/CD
Step 1: If the medium is idle, transmit
Step 2: If the medium is busy, continue to listen until
the channel is idle then transmit
Step 3: If a collision is detected during transmission,
cease transmitting
Step 4: Wait a random amount of time and repeats
the same algorithm
47
CSMA/CA (CSMA with collision Avoidance)
• All terminals listen to the same medium as CSMA/CD.
• Terminal ready to transmit senses the medium.
• If medium is busy it waits until the end of current transmission.
• It again waits for an additional predetermined time period DIFS
(Distributed inter frame Space).
• Then picks up a random number of slots (the initial value of
backoff counter) within a contention window to wait before
transmitting its frame.
• If there are transmissions by other terminals during this time
period (backoff time), the terminal freezes its counter.
• It resumes count down after other terminals finish
transmission + DIFS. The terminal can start its transmission
when the counter reaches to zero.
49
CSMA/CA (Cont’d)

Node A’s frame Node B’s frame Node C’s frame

Delay: B
Delay: C Time
Nodes B & C sense
the medium
Nodes C starts
Nodes B resenses the medium transmitting.
and transmits its frame.
Node C freezes its counter.

Nodes C resenses the


medium and starts
decrementing its counter.

50
CSMA/CA Explained

Contention DIFS Contention window


DIFS window

Medium Busy Next Frame


Time
Defer access Slot

Backoff after defer

DIFS – Distributed Inter Frame Spacing

51
CSMA/CA with ACK
• Immediate Acknowledgements from receiver
upon reception of data frame without any need
for sensing the medium.
• ACK frame transmitted after time interval SIFS
(Short Inter-Frame Space) (SIFS < DIFS)
• Receiver transmits ACK without sensing the
medium.
• If ACK is lost, retransmission done.

52
CSMA/CA/ACK
DIFS Time
Data
Source
SIFS
ACK
Destination
DIFS Contention window

Next Frame
Other
Defer access Backoff after defer

SIFS – Short Inter Frame Spacing

53
CSMA/CA with RTS/CTS
• Transmitter sends an RTS (request to send) after
medium has been idle for time interval more than
DIFS.
• Receiver responds with CTS (clear to send) after
medium has been idle for SIFS.
• Then Data is exchanged.
• RTS/CTS is used for reserving channel for data
transmission so that the collision can only occur in
control message.

54
CSMA/CA with RTS/CTS (Cont’d)
DIFS SIFS
RTS Data Time
Source
SIFS SIFS

CTS ACK
Destination
DIFS
Contention window

Next Frame
Other

Defer access Backoff after defer

55
RTS/CTS
Node A Node B

Propagation delay
RTS

CTS

Data

ACK

56
CONTROLLED ACCESS

In controlled access, the stations consult one another to find which station has the
right to send. A station cannot send unless it has been authorized by other stations.
We discuss three popular controlled-access methods.

Reservation
Polling
Token Passing
:
Polling
Token passing
IEEE 802.3Ethernet
1.IEEE STANDARDS
IEEE has subdivided the data-link layer into two sublayers:

logical link control (LLC)


flow control, error control, and part of the framing duties are collected into one
sub layer called the logical link control

Media access control (MAC)


Media access control that defines the specific access method for each LAN. For
example, it defines CSMA/CD as the media access method for Ethernet LANs
and defines the token-passing method for Token Ring and Token Bus LANs.
Standard Ethernet
Implementation of standard Ethernet
Fast Ethernet (100 Mbps)

You might also like