CN Mod2
CN Mod2
By,
Prof. Nilam Navil Rais
Module 2
4
Physical Layer in OSI Model
• It is the layer that interacts with the transmission media,
the physical part of the network that connects network
components together.
• This layer is involved in physically carrying information
from one node in the network to the next.
• It maintains the data quality by implementing the
required protocols on different network modes and
maintaining the bit rate through data transfer using a
wired or wireless medium.
• The data in the data link layer consists of Os and 1s
organized into frames that are ready to be sent across
the transmission medium. This stream of Os and 1s
must first be converted into another entity: signals.
• The physical layer converts the data frame received
from the data link layer into bits, i.e., in terms of ones
5
and zeros.
Attributes of the physical layer:
1. Signals: The data is first converted to a signal for efficient
data transmission. There are two kinds of signals:
• Analog Signals: These signals are continuous waveforms in
nature and are represented by continuous electromagnetic
waves for the transmission of data.
• Digital Signals: These signals are discrete in nature and
represent network pulses and digital data from the upper
layers.
12
Physical Topology
13
Physical Topology
1. Star Topology:
• Star topology is a sort of network topology in which
each node or device in the network is individually
joined to a central node, which can be a switch or a
hub. This topology looks like a star, due to which this
topology is called star topology.
14
Physical Topology
2. Bus Topology:
• Bus topology comprises a single communication line
or cable that is connected to each node. The backbone
of this network is the central cable, and each node can
communicate with other devices through the central
cable.
15
Physical Topology
2. Bus Topology:
• The signal goes from the ground terminator to the
other terminator of the wire. The terminator stops the
signal once it reaches the end of the wire to avoid
signal bounce.
• Each computer communicates independently with
other computers in what is called a peer-to-peer
network.
• Each computer has a unique address, so if a message
is to be sent to a specific computer, the device can
communicate directly with that computer.
17
Physical Topology
3. Ring Topology:
• As you can see, all four devices are connected to each
other in the form of a ring. Each device has two
neighbors. Node 2 and Node 4 are neighbors of Node
1; similarly, Node 1 and Node 3 are neighbors of
Node 2, and so on.
• The advantage of ring topology is that if you want to
add another device to the ring, you will need an
additional cable to do so. Similarly, you can remove a
device and join the wires.
18
Physical Topology
4. Mesh Topology:
• In a mesh topology, each system is directly joined to
every other system.
19
Physical Topology
4. Mesh Topology:
• The advantage of mesh topology is that there will be
no traffic issues as each device has a dedicated
communication line.
• If one system is not functioning, it will not affect
other devices.
• It provides more security or privacy.
• The drawback of mesh topology is that it is expensive
and more complex than other topologies.
20
Transmission Media
Transmission medium and physical layer
Classes of transmission media
GUIDED MEDIA
1. Twisted-Pair Cable
2. Coaxial Cable
3. Fiber-Optic Cable
Twisted-pair cable
It is cheap.
Installation of the unshielded twisted pair is easy.
It can be used for high-speed LAN.
• Disadvantage:
• Disadvantages
Characteristics of Microwave:
Advantages Of Microwave:
• Characteristics Of Infrared:
3. Flow Control:
•Issue: Managing the rate of data transmission between sender and
receiver to prevent data loss or overflow.
•Considerations: Implementing flow control mechanisms such as
sliding window protocols (e.g., Stop-and-Wait, Go-Back-N,
Selective Repeat) to regulate data flow based on the receiver's
capacity.
Data Link Layer Design Issues:
(Functions of Data Link Layer )
4. Access Control:
•Issue: Controlling access to the shared physical medium in multi-
access networks.
•Considerations: Selecting appropriate access control methods
like CSMA/CD (used in Ethernet) or CSMA/CA (used in wireless
networks) to manage medium contention and prevent collisions.
5. Addressing:
•Issue: Assigning and managing unique addresses (e.g., MAC
addresses) to network devices.
•Considerations: Designing efficient addressing schemes to ensure
each device on a network segment is uniquely identified,
facilitating accurate data delivery.
Data Link Layer Design Issues:
(Functions of Data Link Layer )
6. Reliability and Efficiency:
•Issue: Balancing reliability (data integrity and delivery assurance)
with efficiency (minimal overhead and maximum throughput).
•Considerations: Optimizing protocol design and parameters (e.g.,
acknowledgment mechanisms, retransmission strategies) to achieve
a balance between reliability and performance.
9. Scalability:
•Issue: Supporting network growth and increasing demands for
bandwidth and connectivity.
•Considerations: Designing scalable protocols and architectures
that can accommodate expanding network infrastructures and
evolving technological advancements.
Data Link Layer Design Issues:
(Functions of Data Link Layer )
• Payload: The payload is the actual data from the Network Layer
packet
It is encapsulated within a
Correlation It encapsulates a packet.
frame.
It is associated with Layer It is associated with Layer
Layer
2. 3.
• Fixed-sized Framing
Here the size of the frame is fixed and so the frame
length acts as delimiter of the frame. Consequently, it
does not require additional boundary bits to identify the
start and end of the frame.
Example − ATM cells.
Drawback: It goes through internal fragmentation when
the size of data is less than as compared to the size of
the frame.
Types of Framing:
• Any pattern used for the flag could also be part of the
information.
• If this happens, the receiver, when it encounters this
pattern in the middle of the data, thinks it has reached
the end of the frame.
• To fix this problem, a byte-stuffing (or character
stuffing) strategy is added to character-oriented
framing.
Character-Oriented protocol (Byte Stuffing) :
• Burst Error:
The two or more bits are changed from 0 to
1 or from 1 to 0 is known as Burst Error.
The Burst Error is determined from the first
corrupted bit to the last corrupted bit.
Redundancy
• Retransmission
–Receiver detects the error and asks the sender
for retransmission.
Coding
•It can only detect single-bit errors which are very rare.
•If two bits are interchanged, then it cannot detect the
errors.
Two-Dimensional Parity Check
•If two bits in one data unit are corrupted and two bits
exactly the same position in another data unit are also
corrupted, then 2D Parity checker will not be able to detect
the error.
•This technique cannot be used to detect the 4-bit errors or
more in some cases.
Hamming codes
Hamming Weight:
• The Hamming weight of a codeword is equal to the number of
non-zero elements in the codeword.
• Hamming weight of a codeword c is denoted by w(c). It refers to
the number of 1’s in a binary code.
• Example:
Hamming Distance
• Hamming distance between two codewords is the number of
places by which the codewords differ.
• For two codes c1 and c2, the hamming distance is denoted as
d(c1 ,c2).
• It is the number of positions at which corresponding symbols of
two equal length strings are different.
• It is named after Richard Hamming, an American mathematician
and computer engineer.
• Example:
Considering codewords c1=0100 and c2=1111,
the hamming distance between the two codewords is 3 because they
differ at the 1st, 3rd and 4th places in the code.
Hamming codes
1. Redundant Bits - These are the extra binary bits added externally
into the original data bit to prevent damage to the transmitted data and
are also needed to recover the original data.
2 ^ r >= d+r+1
Where, d - “Data Bits”
r - “Redundant Bits”, r = {1, 2, 3, …….. n}
Step 1 – Find the position of the data bits and the number of redundant
bits in the original data. The number of redundant bits is deduced from
the expression [2^r >= d+r+1].
Step 2 - Fill in the data bits and redundant bit, and find the parity bit
value using the expression [2^p, where, p - {0,1,2, …… n}].
Step 3 - Fill the parity bit obtained in the original data and transmit the
data to the receiver side.
Step 4 - Check the received data using the parity bit and detect any error
in the data, and in case damage is present, use the parity bit value to
correct the error.
Example for Hamming Code
P1: 1, 3, 5, 7, 9, 11
P1 - P1, 0, 1, 1, 1, 1
P1 - 0
Example for Hamming Code
P2 - P2, 0, 0, 1, 0, 1
P2 - 0
Example for Hamming Code
3. P4 parity bit is deduced by checking all the bits with 1’s in the third
significant location.
P4: 4, 5, 6, 7
P4 - P4, 1, 0, 1
P4 - 0
4. P8 parity bit is deduced by checking all the bits with 1’s in the fourth
significant location.
P8: 8, 9, 10, 11
P8 – P8, 1, 0, 1
P8 - 0
Example for Hamming Code
To identify the position of the error bit, use the new parity values as,
0 1 1 1
[0+2^2+2^1+2^0]
7, i.e., same as the assumed error position.
To correct the error, simply reverse the error bit to its complement, i.e., for
this case, change 0 to 1, to obtain the original data bit.
Example for Hamming Code
1 1 P8 1 0 1 P4 1 P2 P1
Example for Hamming Code
1. P1 parity bit is deduced by checking all the bits with 1’s in the least
significant location.
P1: 1, 3, 5, 7, 9
P1 - P1, 1, 1, 1, 1
P1 - 0
2. P2 parity bit is deduced by checking all the bits with 1’s in the second
significant location.
P2: 2, 3, 6, 7, 10
P2 - P2, 1, 0, 1, 1
P2 - 1
Example for Hamming Code
3. P4 parity bit is deduced by checking all the bits with 1’s in the third
significant location.
P4: 4, 5, 6, 7
P4 - P4, 1, 0, 1
P4 - 0
4. P8 parity bit is deduced by checking all the bits with 1’s in the fourth
significant location.
P8: 8, 9, 10
P8 – P8, 1, 1
P8 - 0
Example for Hamming Code
1 1 0 1 0 1 0 1 1 0
Example for Hamming Code
10 9 8 7 6 5 4 3 2 1
1 1 0 1 0 1 0 1 1 0
1 1 0 1 0 0 0 1 1 0
Then by applying the parity bit technique, we can identify the error:
P1: 1, 3, 5, 7, 9
P1 - 0, 1, 0, 1, 1
P1 - 1
Example for Hamming Code
10 9 8 7 6 5 4 3 2 1
1 1 0 1 0 1 0 1 1 0
1 1 0 1 0 0 0 1 1 0
P2: 2, 3, 6, 7, 10 P4: 4, 5, 6, 7
P2 - 1, 1, 0, 1, 1 P4 - 0, 0, 0, 1
P2 -0 P4 - 1
P8: 8, 9, 10
P8 – 0, 1, 1
P8 - 0
Example for Hamming Code
To correct the error, simply reverse the error bit to its complement, i.e., for
this case, change 1 to 0, to obtain the original data bit.
10 9 8 7 6 5 4 3 2 1
1 1 0 1 0 0 0 1 1 0
original data: 1 1 0 1 0 1 0 1 1 0
Checksum
1. Checksum Generator
Checksum Checker
Example:
1. The binary data is first augmented by adding k-1 zeros in the end
of the data
2. Use modulo-2 binary division to divide binary data by the key and
store remainder of division.
3. Append the remainder at the end of the data to form the encoded
data and send the same
• Receiver Side (Check if there are errors introduced in
transmission):
• Modulo 2 Division:
Key - 1101
3 2
[ Or generator polynomial x + x + 1]
Cyclic Redundancy Check (CRC)
Sender Side:
Remainder is 001
Hence the encoded data sent is:
100100001.
Cyclic Redundancy Check (CRC)
Receiver Side:
Code word received at the receiver side 100100001
Key - 1101
Cyclic Redundancy Check (CRC)
Sender Side:
Remainder is 001
Hence the encoded data sent is:
100100001.
Cyclic Redundancy Check (CRC)
Receiver Side:
Receiver Side:
1. Simplest Protocol
2. Stop-and-Wait Protocol
1. SIMPLEST Protocol:
• direct transfer of data from the source to the destination without any
intermediate processing.
• the channel is assumed to be noise-free
• sending one bit at a time, with no error correction or flow control
mechanisms in place.
• does not have any mechanisms for controlling the flow of data or
detecting and correcting errors
• protocol assumes that the receiver is always ready to process any data
frames sent by the sender immediately.
• only allows data to flow from the sender to the receiver, is known as a
one-way protocol.
• this protocol is unidirectional, there is no need for an acknowledgment
or confirmation of receipt.
• there is no data loss during transmission, there is no need to resend or
retransmit the data.
Flow Diagram in Simplest Protocol:
2. STOP-AND-WAIT Protocol
• flow of data frames at the receiver side may become too fast for
it to be processed, causing the need for temporary storage.
• the limited storage space of the receiver may result in the loss
or discarding of frames, or even denial of service.
• To prevent this, the sender must slow down their rate of
transmission, which is achieved through the use of ACK
messages from the receiver.
• The sender sends a single frame and waits for confirmation
from the receiver before sending the next one, adding flow
control to the previous protocol.
• communication remains unidirectional for data frames, but
ACK frames flow in the opposite direction.
Flow Diagram of STOP-AND-WAIT Protocol :
NOISY CHANNELS
The bottom sublayer of the Data Link Layer is the Media Access
Control.
It is also known as Medium Access Control.
It provides multiplexing and flow control for the transmission media.
The main responsibility of this sublayer is to encapsulate the frame,
check for transmission errors, and then allow the frame to be
forwarded to the upper layer.
It determines who is permitted to access the media at any given
time.
THE CHANNEL ALLOCATION PROBLEM
1. Pure Aloha
2. Slotted Aloha
Pure Aloha
Where,
Vt is a Vulnerable Time for Pure Aloha,
Tt is the Transmission Time of the station.
Pure Aloha
1. 1-Persistent:
In the 1-Persistent mode of CSMA that defines each node,
first sense the shared channel and if the channel is idle, it
immediately sends the data.
Else it must wait and keep track of the status of the channel
to be idle and broadcast the frame unconditionally as soon
as the channel is idle.
CSMA (Carrier Sense Multiple Access)
1. 1-Persistent:
If the station detects the channel as idle then the station will
immediately send the data frame with 1 probability that’s why
the name of this method is 1-persistent.
In this method, there is a high possibility of collision as two or
more station senses the channel idle at the same time and
transmits data simultaneously which may lead to a collision.
CSMA (Carrier Sense Multiple Access)
2. Non-Persistent:
In this method of CSMA, if the station finds the channel busy then it
will wait for a random amount of time before sensing the channel
again.
If the station wants to transmit the data then first of all it will sense
the medium.
If the medium is idle then the station will immediately send the data.
Otherwise, if the medium is busy then the station waits for a random
amount of time and then again senses the channel after waiting for
a random amount of time.
there is less chance of collision in comparison to the 1-persistent
method as this station will not continuously sense the channel but
waiting for a random amount of time.
the random amount of time is unlikely to be the same for two
stations that’s why this method reduces the chance of collision.
CSMA (Carrier Sense Multiple Access)
2. Non-Persistent:
CSMA (Carrier Sense Multiple Access)
3. P-Persistent:
• When the transmitting node is ready to transmit data, it senses the
transmission medium for idle or busy.
• If idle, then it transmits immediately.
• If busy, then it senses the transmission medium continuously until it
becomes idle, then transmits with probability p.
4. O- Persistent:
• In this method of CSMA supervisory node assigns a transmission
order to each node in the network.
• When the channel is idle instead of immediately sending the data
channel will wait for its transmission order assigned to them.
CSMA CD
(Carrier Sense Multiple Access Collision Detection)