Lecture 5
Lecture 5
1
Lecture # 6: Data Link Layer
Basic Concepts
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
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:
5
Lecture # 5: Data Link Layer
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
Framing:
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:
11
Lecture # 5: Data Link Layer
Framing: Byte stuffing and unstuffing ( in a character-
oriented protocol)
Framing:
Bit stuffing and unstuffing (in a bit-oriented protocol)
15
Lecture # 5: Data Link Layer
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:
18
Lecture # 5: Data Link Layer
Flow control:
19
Lecture # 5: Data Link Layer
Error detection and correction:
23
Lecture # 5: Data Link Layer
Decoding process: Example
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:
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 :
31
Lecture # 5: Data Link Layer
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
36
Lecture # 5: Data Link Layer
Noisy Channels
37
Lecture # 5: Data Link Layer
Noisy Channels
38
Lecture # 5: Data Link Layer
Design of the Stop-and-Wait ARQ Protocol
39
Lecture # 5: Data Link Layer
40
Lecture # 5: Data Link Layer
41
Lecture # 5: Data Link Layer
42
Lecture # 5: Data Link Layer
Flow diagram for Stop-and-Wait ARQ
43
Lecture # 5: Data Link Layer
Homework reading:
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
47
Lecture # 5: Data Link Layer
12.48
Lecture # 5: Data Link Layer
12.49
Lecture # 5: Data Link Layer
12.50
Lecture # 5: Data Link Layer
12.51
Lecture # 5: Data Link Layer
12.53
Lecture # 5: Data Link Layer
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.
12.57
Lecture # 5: Data Link Layer
12.58
Lecture # 5: Data Link Layer
12.59
Lecture # 5: Data Link Layer
CONTROLLED ACCESS
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.
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
• The IEEE 802 committee had formulated the standards for LAN
12.68
Lecture # 5: Data Link Layer
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:
12.71