Chapter 4.1 - B
Chapter 4.1 - B
Chapter 4.1 - B
Part- II
(SE 3051)
Physical Layer
The physical layer coordinates the functions required to carry a bit stream
over a physical medium.
It deals with the mechanical and electrical specifications of the interface and
transmission medium.
It also defines the procedures and functions that physical devices and
interfaces have to perform for transmission to occur.
2
Physical layer
the characteristics of the interface between the devices and the transmission
encoded into signals - electrical or optical. The physical layer defines the
type of encoding (how 0s and 1s are changed to signals) (Refer chapter one).
3. Data rate. The transmission rate - the number of bits sent each second - is
also defined by the physical layer. In other words, the physical layer defines
4. Synchronization of bits. The sender and receiver not only must use the
same bit rate but also must be synchronized at the bit level. In other words,
The data link layer is responsible for moving frames from one hop (node) to the next.
7
Layer 2 frame structure
Header Trailer
Start Frame Stop Frame
Data
(Flag) Address Type/Length FCS (Flag)
9
MAC Addresses and Hexadecimal
10
MAC Addresses Representations
11
Unicast MAC Address
12
Broadcast MAC Address
IP address
o Similar to the address of a person
o Based on where the host is actually located
o Known as a logical address because assigned logically
o Assigned to each host by a network administrator
Both the physical MAC and logical IP addresses are required for a computer to
communicate just like both the name and address of a person are required to send
15
a letter
Contd.
1. Flow control. If the rate at which the data are absorbed by the receiver is
less than the rate at which data are produced in the sender, the data link
layer imposes a flow control mechanism to avoid overwhelming the
receiver.
2. Error control. The data link layer adds reliability to the physical layer by
adding mechanisms to detect and retransmit damaged or lost frames.
It also uses a mechanism to recognize duplicate frames.
Error control is normally achieved through a trailer added to the end
of the frame.
3. Access control. When two or more devices are connected to the same
link, data link layer protocols are necessary to determine which device has
control over the link at any given time. 16
Hop-to-hop (node-to-node) delivery by data link layer
17
Contd.
As the figure above shows, communication at the data link layer occurs between
two adjacent nodes.
To send data from A to F, three partial deliveries are made.
First, the data link layer at A sends a frame to the data link layer at B (a
router).
Second, the data link layer at B sends a new frame to the data link layer at E.
Finally, the data link layer at E sends a new frame to the data link layer at F.
Note that the frames that are exchanged between the three nodes have
different values in the headers. The frame from A to B has B as the destination
address and A as the source address. The frame from B to E has E as the
destination address and B as the source address. The frame from E to F has F as
the destination address and E as the source address. The values of the trailers
can also be different if error checking includes the header of the frame. 18
Framing
The data link layer, needs to pack bits into frames, so that each frame is
distinguishable from another. Our 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.
In addition, each envelope defines the sender and receiver addresses
since the postal system is a many-to-many carrier facility.
Framing in the data link layer separates a message from one source to a
destination, or from other messages to other destinations, by adding a
sender address and a destination address.
The destination address defines where the packet is to go; the sender
address helps the recipient acknowledge the receipt. 19
Contd.
NB: Addressing here is about the next node in the LAN
Although the whole message could be packed in one frame, that is not
normally done.
One reason is that a frame can be very large, making flow and error
When a message is carried in one very large frame, even a single-bit error
example of this type of framing is the ATM wide-area network, which uses
frame and the beginning of the next frame. Historically, two approaches were
approach. 21
Frame Processing
MAC addresses assigned to workstations, servers, printers, switches, and
routers
Example MACs: 00-05-9A-3C-78-00, 00:05:9A:3C:78:00, or
0005.9A3C.7800.
Matches the destination MAC of the frame, the NIC passes the frame up
22
Ethernet Encapsulation
Early versions of Ethernet were relatively slow at 10 Mbps
Ethernet frame structure adds headers and trailers around the Layer 3 PDU to
encapsulate the message being sent
Ethernet II is the
Ethernet frame format
used in TCP/IP
networks. 23
Contd.
Preamble and Start Frame Frame Check Sequence Field
Delimiter Fields Used to detect errors in a frame with cyclic
Used for synchronization redundancy check (4 bytes), if calculations
between the sending and match at source and receiver, no error occurred.
receiving devices
Ethernet II and IEEE 802.3 standards define the minimum frame size as
frame”
If size of a transmitted frame is less than the minimum or greater than the
Byte stuffing is the process of adding 1 extra byte whenever there is a flag
or escape character in the text.
29
Bit-Oriented Protocols
In a bit-oriented protocol, the data section of a frame is a sequence of bits to
be interpreted by the upper layer as text, graphic, audio, video, and so on.
However, 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, as shown in the figure.
30
Contd.
This flag can create the same type of problem we saw in the byte-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.
In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra
0 is added. This extra stuffed bit is eventually removed from the data by
the receiver.
Note that the extra bit is added after one 0 followed by five 1s regardless
of the value of the next bit.
This guarantees that the flag field sequence does not inadvertently appear
in the frame. 31
Contd.
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 mistaken the pattern 0111110 for a flag. 32
Contd.
The above figure shows bit stuffing at the sender and bit removal at
the receiver.
Note that even if we have a 0 after five 1s, we still stuff a 0. The 0 will
be removed by the receiver.
This means that if the flag like pattern 01111110 appears in the data,
it will change to 011111010 (stuffed) and is not mistaken as a flag by
the receiver.
The real flag 01111110 is not stuffed by the sender and is recognized
by the receiver as a flag.
33
Flow Control
• Flow control coordinates the amount of data that can be sent before
receiving an acknowledgment and is one of the most important duties
of the data link layer. 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. Incoming data must be checked
and processed before they can be used. 34
Contd.
• The rate of such processing is often slower than the rate of
transmission. For this reason, each receiving device has a block of
memory, called a buffer, reserved for storing incoming data until they
are processed. If the buffer begins to fill up, the receiver must be able
to tell the sender to halt transmission until it is once again able to
receive.
35
Media Access control
• The data link layer can further be divided in to two layers: the upper
sub-layer that is responsible for flow and error control is called the
logical link control (LLC) layer; the lower sub-layer that is mostly
responsible for multiple access resolution is called the media access
control (MAC) layer
• 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. The problem of controlling the access
to the medium is similar to the rules of speaking in an assembly. The
procedures guarantee that the right to speak is upheld and ensure
that two people do not speak at the same time, do not interrupt
each other, do not monopolize the discussion, and so on. 36
Contd.
37
Random Access
In random access or contention methods, no station is superior to
another station and none is assigned the control over another.
No station permits, or does not permit, another station to send.
42
Procedure for pure ALOHA protocol
43
Carrier Sense Multiple Access (CSMA)
Protocols that listen for a carrier and act accordingly are called
carrier sense protocols.
Carrier sensing allows the station to detect whether the medium is
currently being used.
Schemes that use a carrier sense circuits are classed together as
carrier sense multiple access or CSMA schemes.
There are two variants of CSMA. CSMA/CD and CSMA/CA
The simplest CSMA scheme is for a station to sense the medium,
sending packets immediately if the medium is idle.
If the station waits for the medium to become idle it is called
persistent otherwise it is called non persistent. 44
Persistent
Persistent:-wait if busy and transmit only when the media becomes
When a station has the data to send, it first listens the channel to
If it senses the channel idle, station starts transmitting the data.
45
Non-Persistent
Non persistent CSMA is less aggressive compared to persistent
protocol.
In this protocol, before sending the data, the station senses the
But if the channel is busy, the station does not continuously sense
can transmit.
transmit again.
Reading Assignment: Read About CSMA/CA and understand the difference with CSMA/CD48
Controlled access
other stations.
49
Reservation
In the reservation 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
mini slots in the reservation frame.
Each mini slot belongs to a station. When a station needs to send a
data frame, it makes a reservation in its own mini slot.
The stations that have made reservations can send their data
frames after the reservation frame.
50
Contd.
• The following figure shows a situation with five stations and a five-
mini slot reservation frame.
• In the first interval, only stations 1, 3, and 4 have made reservations.
In the second interval, only station 1 has made a reservation.
51
Polling
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.
It is up to the primary device to determine which device is
allowed to use the channel at a given time.
The primary device, therefore, is always the initiator of a session.
52
Contd.
Page 56