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

Lecture 5

The document discusses concepts related to the data link layer of computer networks. It covers basic concepts such as framing, error detection, flow control, and media access control. Specifically, it discusses how the data link layer deals with errors and reliable transmission of frames between connected machines using techniques like error correcting codes, framing, and acknowledgement-based error recovery.

Uploaded by

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

Lecture 5

The document discusses concepts related to the data link layer of computer networks. It covers basic concepts such as framing, error detection, flow control, and media access control. Specifically, it discusses how the data link layer deals with errors and reliable transmission of frames between connected machines using techniques like error correcting codes, framing, and acknowledgement-based error recovery.

Uploaded by

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

UNIVERSITY OF RWANDA

College of Science and Technology

Module ETE 4261:


Computer Networks

Lecture # 5: Data Link Layer

1
Lecture # 6: Data Link Layer
Basic Concepts

 Deals with algorithms for:

 achieving reliable, efficient communication of whole


units of information called frames (rather than
individual bits, as in the physical layer) between two
machines connected by a communication channel

2
Lecture # 5: Data Link Layer
Basic concepts
 The data link layer uses the services of the physical layer
to send and receive bits over communication channels

 Limitations of physical layer:


1. Communication channels make errors occasionally
2. They have only a finite data rate
3. There is a nonzero propagation delay between the time a
bit is sent and the time it is received

3
Lecture # 5: Data Link Layer

Functions include:

 encoding
 sending, receiving and framing data (all protocols)
 error checking using CRC (cyclic redundancy checks)
 error recovery: acknowledgement and retransmission

4
Lecture # 5: Data Link Layer

Sub-layers:

 Logical link control (LLC) layer: is the upper sublayer of


datalink layer and is responsible for flow and error control

 Media access control (MAC): is the lower sublayer that is


mostly responsible for multiple- access resolution

5
Lecture # 5: Data Link Layer

Data link control:

 Framing
 Flow and error control
 Protocols
 Noisy and noiseless channel

6
Lecture # 5: Data Link Layer

Framing
 Frame management is the heart of data link layer
 Data link layer
 breaks up the bit stream into discrete frames, so that
each frame is distinguishable from another
 the postal system practices a type of framing. The
simple act of inserting a letter into an envelope separates
one piece of information from another; the envelope
serves as the delimiter.
 Frame can be of:
 Fixed-Size framing
 Variable-Size framing
7
Lecture # 5: Data Link Layer
Framing:
 Fixed-Size Framing: there is no need for defining the
boundaries of the frames; the size itself can be used as a
delimiter.
An example of this type of framing is the ATM wide-area
network, which uses frames of fixed size called cells

 Variable-Size Framing: is prevalent in LANs. In


variable-size framing, we need a way to define the end of
the frame and the beginning of the next. Historically, two
approaches were used for this purpose: a character-oriented
approach and a bit-oriented approach.
8
Lecture # 5: Data Link Layer

Framing:

 Each frame contains a frame header, a payload field for


holding the packet, and a frame trailer

9
Lecture # 5: Data Link Layer

Framing:
 Four methods:
1) Byte count: uses a field in the header to specify the
number of bytes in the frame
2) Flag bytes with byte stuffing: solves the problem of
resynchronization after an error by having each frame
start and end with special bytes
3) Flag bits with bit stuffing: solves the problem of byte
stuffing, which is that it is tied to using 8-bit bytes
4) Physical layer coding violations: encoding of bits as
signals often includes redundancy to help the receiver

10
Lecture # 5: Data Link Layer

Framing:

 A frame in a character-oriented protocol

 A frame in a bit-oriented protocol

11
Lecture # 5: Data Link Layer
Framing: Byte stuffing and unstuffing ( in a character-
oriented protocol)

Byte stuffing is the process of adding 1 extra byte whenever there is


12
a flag or escape character in the text
Lecture # 5: Data Link Layer

Framing:
Bit stuffing and unstuffing (in a bit-oriented protocol)

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.
13
Lecture # 5: Data Link Layer
 Encoding:

There are various forms of encoding:


 NRZ low level for 0, high for 1. But the signal can stay
too long in one state
 NRZI change level for a 1, unchanged signal for 0.
Solves problem for 1s but not 0s
 Manchester encoding which does an XOR of the bit with
the clock signal (which changes every interval). Clearly
produces lots of transitions but only provides half the bit
rate for any Baud rate (the maximum number of transitions
the line can make in a second).
14
Lecture # 5: Data Link Layer
 Encoding:

15
Lecture # 5: Data Link Layer

Flow and Error Control:

 Flow control: refers to a set of procedures used to


restrict the amount of data that the sender can send before
waiting for acknowledgment

 Error control: in the data link layer is based on


automatic repeat request, which is the retransmission of
data

16
Lecture # 5: Data Link Layer
 Error control:
 How to make sure all frames are delivered to the
network layer at the destination and in the proper order?
 For unacknowledged connectionless service, sender
keeps outputting frames
 For acknowledged or connection-oriented service, use
control frames to send feedback: positive or negative
acknowledgment
 To handle loss of frames or acknowledgements, use
timers
 If timer goes off, retransmit.
What if a frame is received multiple times? Need to use
sequence numbers 17
Lecture # 5: Data Link Layer
 Flow control:

• What to do when a sender wants to transmit frames faster


than the receiver can accept them?
• Example: a smart phone requests a web page from a
powerful server.
Two approaches are commonly used:
1. Feedback-based flow control.
 Receiver sends information to the sender giving it
permission to send more data

18
Lecture # 5: Data Link Layer
 Flow control:

Two approaches are commonly used.


2. Rate-based flow control.
 Protocol has a built-in mechanism that limits the rate,
without using feedback.
• Rate based is only used in transport layer. Feedback-
based is more common
• Most current hardware NICs, run at wire speed; can
handle frames as fast as they arrive.

19
Lecture # 5: Data Link Layer
Error detection and correction:

 Network designers have developed two basic strategies


for dealing with errors:
 Error-correcting codes/ Forward error correction
(FEC): include enough redundant information to enable
receiver to deduce what the transmitted data must have
been: Used in physical and data link layers
 Error-detecting codes: include only enough
redundancy to allow receiver to deduce that an error has
occurred (but not which error) and have it request a
retransmission. Used in data link and higher layers.
20
Lecture # 5: Data Link Layer
 Examples of Errors:

• On channels that are highly reliable (fiber), it is cheaper to use


an error-detecting code and just retransmit faulty block.
• On channels with many errors (wireless), it is better to use
FEC. Retransmissions are also likely to have errors.

Two error models.


a)Isolated single-bit errors: caused by thermal noise
b)Errors tend to come in bursts: caused by deep fade on
a wireless channel or transient electrical interference.
Another type: Erasure channel: signal declared as lost, far
from 0 or 1. Easier to correct.
21
Lecture # 5: Data Link Layer
Error correcting codes:

A frame consists of 𝑚 data (i.e., message) bits and 𝑟


redundant (i.e. check) bits.
 In a block code, the 𝑟 check bits are computed as a
function of the 𝑚 data bits with which they are associated
 In a linear code, the 𝑟 check bits are computed as a linear
function of the 𝑚 data bits
 In a systematic code, the 𝑚 data bits are sent directly,
along with the check bits, rather than being encoded
themselves before they are sent.
 In a non-systematic code, the output does not contain the
input symbols
22
Lecture # 5: Data Link Layer
Decoding process:

 When a codeword arrives, the receiver redoes the check


bit computations including the values of the received check
bits (called results)
 If check bits are correct then each check result should be
zero (for even parity).
In this case the codeword is accepted as valid.
 If the check results are not all zero, an error has been
detected.
The set of check results forms the error syndrome
that is used to pinpoint and correct the error.

23
Lecture # 5: Data Link Layer
Decoding process: Example

 Example of an (11,7) Hamming code correcting a single


bit error

Homework reading: Discuss Hamming codes

24
Lecture # 5: Data Link Layer
Error detecting codes:
 Signals can be corrupted or misread so it is necessary to have
a way of detecting any corruption
 This is done by computing and sending redundant
information, the receiver recalculates and checks.
o Parity: add one extra bit for every byte (or whatever) so
there is an even (or odd) number of 1s. Not strong
o Checksum: add up all the bytes in a message and send the
sum. Better.
o CRC (cyclic redundancy check), treat n bits of data as
being represented by an n−1 bit polynomial, divide this by
some smaller (carefully chosen) polynomial and use this to
check. This can give quite strong checking of up to 12000
bits with just 32 bits of redundancy. 25
Lecture # 5: Data Link Layer
Error detecting codes:

Homework reading:
Discuss the three error detecting codes ( parity,
checksum, CRC) with examples

26
Lecture # 5: Data Link Layer

Protocol
Here, protocol means how the data link layer can combine
framing, flow control, and error control to achieve the
delivery of data from one node to another.
 The protocols are normally implemented in software by
using one of the common programming languages.

27
Lecture # 5: Data Link Layer

Noiseless channel:

 Assume that we have an ideal channel in which no


frames are lost, duplicated, or corrupted.
 Two protocols for this type of channel:

 Simplest protocol
 Stop-and-Wait protocol

28
Lecture # 5: Data Link Layer

Simplest protocol :
Unrealistic protocol, which we will nickname “Utopia”
 Data are transmitted in one direction only
 Both the transmitting and receiving network layers are
always ready
 Processing time can be ignored
 Infinite buffer space is available
 Communication channel never damages or loses frames
Unrealistic because it does not handle either flow control or error
correction. Its processing is close to that of an unacknowledged
connectionless service that relies on higher layers to solve these
problems. Even an unacknowledged connectionless service would do
some error detection 29
Lecture # 5: Data Link Layer
Simplest protocol : The design of the simplest protocol with
no flow or error control

30
Lecture # 5: Data Link Layer

Simplest protocol :

Algorithm 1: Sender-site algorithm for the simplest


protocol

31
Lecture # 5: Data Link Layer

Simplest protocol :

Algorithm 2: Receiver-site algorithm for the simplest


protocol

32
Lecture # 5: Data Link Layer
Stop-and-Wait protocol : sender sends one frame and then
waits for an acknowledgement before proceeding next frame

33
Lecture # 5: Data Link Layer
Algorithm 3: Sender-site algorithm for Stop-and-Wait Protocol

34
Lecture # 5: Data Link Layer

Algorithm 4: Receiver-site algorithm for Stop-and-Wait Protocol

Note: Protocols in which the sender waits for a positive


acknowledgement before advancing to the next data item are often
called ARQ (Automatic Repeat reQuest) or PAR (Positive
Acknowledgement with Retransmission).
35
Lecture # 5: Data Link Layer

Flow diagram for Stop-and-Wait Protocol

Figure shows that the


sender sends one frame and
waits for feedback from the
receiver. When the ACK
arrives, the sender sends the
next frame. Note that sending
two frames in the protocol
involves the sender in four
events and the receiver in
two events.

36
Lecture # 5: Data Link Layer

Noisy Channels

Although the Stop-and-Wait Protocol gives us an idea of how to


add flow control to its predecessor, noiseless channels are
nonexistent.

Three protocols that use error control:


 Stop-and-Wait Automatic Repeat Request (ARQ)
 Go-Back-N Automatic Repeat Request
 Selective Repeat Automatic Repeat Request

37
Lecture # 5: Data Link Layer

Noisy Channels

Error correction in Stop-and-Wait ARQ is done by keeping a


copy of the sent frame and retransmitting of the frame when the
timer expires
 In Stop-and-Wait ARQ, we use sequence numbers to number
the frames. The sequence numbers are based on modulo-2
arithmetic.
 In Stop-and-Wait ARQ, the acknowledgment number always
announces in modulo-2 arithmetic the sequence number of the
next frame expected.

38
Lecture # 5: Data Link Layer
Design of the Stop-and-Wait ARQ Protocol

39
Lecture # 5: Data Link Layer

Algorithm 5: Sender-site algorithm for Stop-and-Wait ARQ

40
Lecture # 5: Data Link Layer

Algorithm 5: Sender-site algorithm for Stop-and-Wait ARQ

41
Lecture # 5: Data Link Layer

Algorithm 5: Receiver-site algorithm for Stop-and-Wait ARQ

42
Lecture # 5: Data Link Layer
Flow diagram for Stop-and-Wait ARQ

Frame 0 is sent and


acknowledged.
Frame 1 is lost and resent
after the time-out.
The resent frame 1 is
acknowledged and the
timer stops.
Frame 0 is sent and
acknowledged, but the
acknowledgment is lost.
The sender has no idea if
the frame or the
acknowledgment is lost, so
after the time-out, it
resends frame 0, which is
acknowledged.

43
Lecture # 5: Data Link Layer

Homework reading:

 Explain the Go-Back-N protocol


 Explain the Selective Repeat protocol

Fir each protocol, give examples og algorithms

44
Lecture # 5: Data Link Layer
Multiple access:

ALOHA
CSMA: Carrier Sense Multiple Access
CSMA/CD: Carrier Sense Multiple Access with Collision Detection
CSMA/CA: Carrier Sense Multiple Access with Collision Avoidance
FDMA: Frequency division multiple access
TDMA: Time division multiple access
CDMA: Code division multiple access 45
Lecture # 5: Data Link Layer
Multiple access:
 Random Access

In a random access method, each station has the right to the
medium without being controlled by any other station
 However, if more than one station tries to send, there is an
access conflict-collision-and the frames will be either destroyed
or modified.
 To avoid access conflict or to resolve it when it happens, each
station follows a procedure that answers the following questions:
When can the station access the medium?
 What can the station do if the medium is busy?
 How can the station determine the success or failure of
the transmission?
 What can the station do if there is an access conflict?46
Lecture # 5: Data Link Layer
Multiple access: Random Access

ALOHA: uses a very simple procedure called multiple


access (MA).
 CSMA: was proposed to improve ALOHA with the
addition of a procedure that forces the station to sense the
medium before transmitting
 CSMA/CD : tells the station what to do when a
collision is detected.
 CSMA/CA tries to avoid the collision.

47
Lecture # 5: Data Link Layer

Frames in a pure ALOHA network

12.48
Lecture # 5: Data Link Layer

Procedure for pure ALOHA protocol

12.49
Lecture # 5: Data Link Layer

Vulnerable time for pure ALOHA protocol

12.50
Lecture # 5: Data Link Layer

Frames in a slotted ALOHA network

12.51
Lecture # 5: Data Link Layer

Vulnerable time for slotted ALOHA protocol


Lecture # 5: Data Link Layer

Space/time model of the collision in CSMA

12.53
Lecture # 5: Data Link Layer

Vulnerable time in CSMA

12.54
Lecture # 5: Data Link Layer

CSMA/CD Algorithm
1. If the medium is idle, transmit; otherwise, go to step 2.
2. If the medium is busy, continue to listen until the channel is
idle, then transmit immediately.
3. If a collision is detected during transmission, transmit a
brief jamming signal to assure that all stations know that there
has been a collision and then cease transmission.
4. After transmitting the jamming signal, wait a random
amount of time, then attempt to transmit again. Repeat from
step 1.

Ethernet uses CSMA/CD.


12.55
Lecture # 5: Data Link Layer

Collision of the first bit in CSMA/CD


Lecture # 5: Data Link Layer

Collision and abortion in CSMA/CD

12.57
Lecture # 5: Data Link Layer

Flow diagram for the CSMA/CD

12.58
Lecture # 5: Data Link Layer

Flow diagram for CSMA/CA

12.59
Lecture # 5: Data Link Layer

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.

12.60
Lecture # 5: Data Link Layer
CONTROLLED ACCESS
1) Reservation: In this method, a station needs to make a reservation
before sending data.
• Time is divided into intervals. In each interval, a reservation frame
precedes the data frames sent in that interval
• If there are N stations in the system, there are exactly N reservation
minislots in the reservation frame.
• Each minislot belongs to a station. When a station needs to send a
data frame, it makes a reservation in its own minislot.

12.61
Lecture # 5: Data Link Layer
CONTROLLED ACCESS
2) Polling: works with topologies in which one device is designated
as a primary station and the other devices are secondary stations.
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

12.62
Lecture # 5: Data Link Layer
CONTROLLED ACCESS
3) Token passing: the stations in a network are organized in a
logical ring. In other words, for each station, there is a predecessor
and a successor.
The predecessor is the station which is logically before the station in
the ring; the successor is the station which is after the station in the
ring.

12.63
Lecture # 5: Data Link Layer

CHANNELIZATION
Channelization is a multiple-access method in which the available
bandwidth of a link is shared in time, frequency, or through code,
between different stations. In this section, we discuss three
channelization protocols.

Frequency-Division Multiple Access (FDMA)


Time-Division Multiple Access (TDMA)
Code-Division Multiple Access (CDMA)

Application in cellular phone systems

12.64
Lecture # 5: Data Link Layer

FDMA
In FDMA, the available bandwidth
of the common channel is divided into bands that are
separated by guard bands

12.65
Lecture # 5: Data Link Layer

TDMA
In TDMA, the bandwidth is just one channel that is timeshared
between different stations.

12.66
Lecture # 5: Data Link Layer

CDMA
In CDMA, one channel carries all transmissions
simultaneously.

12.67
Lecture # 5: Data Link Layer

DATA LINK of LAN:


•The data link layer of LAN is split into two sub layers.
 Medium Access Control (MAC)
 Logical Link Control Layer (LLC).

• The IEEE 802 committee had formulated the standards for LAN

12.68
Lecture # 5: Data Link Layer

OSI layer for LAN

LLC Frame Format

12.69
Lecture # 5: Data Link Layer
 Destination Service Access Point (DSAP): IEEE 802.2 header begins
with a 1 byte field, which identifies the receiving upper-layer process.
 Source Service Access Point (SSAP): is the 1-byte address, which
identifies the sending upper-layer process.
 Control: employs three different formats, depending on the type of
LLC frame used:
i. Information (I) frame: carries upper-layer information and some
control information
ii. Supervisory (S) frame: provides control information. An S frame
can request and suspend transmission, reports on status, and
acknowledge receipt of I frames
iii. Data: Variable-length field bounded by the MAC format
implemented. Usually contains IEEE 802.2 Subnetwork Access
Protocol (SNAP) header information, as well as application-
specific data.
12.70
Lecture # 5: Data Link Layer
 MAC Frame Format:

 IEEE 802.3 Ethernet Frame Format:

12.71

You might also like