CN Unit 2
CN Unit 2
At the data link layer, it extracts the message from the sender and provides it to the receiver by
providing the sender’s and receiver’s addresses. The advantage of using frames is that data is
broken up into recoverable chunks that can easily be checked for corruption.
The process of dividing the data into frames and reassembling it is transparent to the user and
is handled by the data link layer.
Framing is an important aspect of data link layer protocol design because it allows the
transmission of data to be organized and controlled, ensuring that the data is delivered
accurately and efficiently.
Problems in Framing
• Detecting start of the frame: When a frame is transmitted, every station must be
able to detect it. The station detects frames by looking out for a special sequence of
bits that marks the beginning of the frame i.e. SFD (Starting Frame Delimiter).
• Detecting end of frame: When to stop reading the frame.
• Handling errors: Framing errors may occur due to noise or other transmission
errors, which can cause a station to misinterpret the frame. Therefore, error
detection and correction mechanisms, such as cyclic redundancy check (CRC), are
used to ensure the integrity of the frame.
• Framing overhead: Every frame has a header and a trailer that contains control
information such as source and destination address, error detection code, and other
protocol-related information. This overhead reduces the available bandwidth for
data transmission, especially for small-sized frames.
• Framing incompatibility: Different networking devices and protocols may use
different framing methods, which can lead to framing incompatibility issues.
• Framing synchronization: Stations must be synchronized with each other to
avoid collisions and ensure reliable communication. Synchronization requires that
all stations agree on the frame boundaries and timing, which can be challenging in
complex networks with many devices and varying traffic loads.
• Framing efficiency: Framing should be designed to minimize the amount of data
overhead while maximizing the available bandwidth for data transmission.
Inefficient framing methods can lead to lower network performance and higher
latency.
Types of framing
There are two types of framing:
1. Fixed-size: The frame is of fixed size and there is no need to provide boundaries to the
frame, the length of the frame itself acts as a delimiter.
• Drawback: It suffers from internal fragmentation if the data size is less than the
frame size
• Solution: Padding
2. Variable size: In this, there is a need to define the end of the frame as well as the beginning
of the next frame to distinguish. This can be done in two ways:
1. Length field – We can introduce a length field in the frame to indicate the length
of the frame. Used in Ethernet(802.3). The problem with this is that sometimes the
length field might get corrupted.
2. End Delimiter (ED) – We can introduce an ED(pattern) to indicate the end of the
frame. Used in Token Ring. The problem with this is that ED can occur in the data.
This can be solved by:
1. Character/Byte Stuffing: Used when frames consist of characters. If data
contains ED then, a byte is stuffed into data to differentiate it from ED.
Let ED = “$” –> if data contains ‘$’ anywhere, it can be escaped using ‘\O’
character.
–> if data contains ‘\O$’ then, use ‘\O\O\O$'($ is escaped using \O and \O is escaped
using \O).
Single-Bit Error
Multiple-Bit Error
A multiple-bit error is an error type that arises when more than one bit in a data transmission
is affected. Although multiple-bit errors are relatively rare when compared to single-bit errors,
they can still occur, particularly in high-noise or high-interference digital environments.
Multiple-Bit Error
Burst Error
When several consecutive bits are flipped mistakenly in digital transmission, it creates a burst
error. This error causes a sequence of consecutive incorrect values.
Burst Error
CRC
Working
We have given dataword of length n and divisor of length k.
Step 1: Append (k-1) zero’s to the original message
Step 2: Perform modulo 2 division
Step 3: Remainder of division = CRC
Step 4: Code word = Data with append k-1 zero’s + CRC
Note:
• CRC must be k-1 bits
• Length of Code word = n+k-1 bits
Example: Let’s data to be send is 1010000 and divisor in the form of polynomial is x3+1. CRC
method discussed below.
Advantages of Error Detection
• Increased Data Reliability: Error detection ensures that the data transmitted over
the network is reliable, accurate, and free from errors. This ensures that the recipient
receives the same data that was transmitted by the sender.
• Improved Network Performance: Error detection mechanisms can help to
identify and isolate network issues that are causing errors. This can help to improve
the overall performance of the network and reduce downtime.
• Enhanced Data Security: Error detection can also help to ensure that the data
transmitted over the network is secure and has not been tampered with.
Disadvantages of Error Detection
• Overhead: Error detection requires additional resources and processing power,
which can lead to increased overhead on the network. This can result in slower
network performance and increased latency.
• False Positives: Error detection mechanisms can sometimes generate false
positives, which can result in unnecessary retransmission of data. This can further
increase the overhead on the network.
• Limited Error Correction: Error detection can only identify errors but cannot
correct them. This means that the recipient must rely on the sender to retransmit the
data, which can lead to further delays and increased network overhead.
This message is transmitted at the receiver’s end. Suppose, bit 6 becomes corrupted and
changes to 1. Then the message becomes ‘10101101110.’ So at the receiver’s end the number
of 1’s in the respective bit positions of R1, R2, R3, and R4 is rechecked to correct the corrupted
bit. This is done in the following steps: For all the parity bits we will check the
• For R1: bits 1, 3, 5, 7, 9, and 11 are checked. We can see that the number of 1’s in
these bit positions is 4(even) so R1 = 0.
• For R2: bits 2,3,6,7,10,11 are checked. You can observe that the number of 1’s in
these bit positions is 5(odd) so we get a R2 = 1.
• For R3: bits 4, 5, 6, and 7 are checked. We see that the number of 1’s in these bit
positions is 3(odd). Hence, R3 = 1.
• For R8: bits 8,9,10,11 are observed. Here, the number of 1’s in these bit positions
is 2 and that’s even so we get R4 = 0.
If we observe the Redundant bits, they give the binary number 0110 whose decimal
representation is 6. The error in bit 6 has been successfully identified and corrected. By
rechecking the parity bits, we could detect that R4 was not matching its expected value,
pointing us to the corrupted bit. The bit 6 should have been 1, and after correcting it, the
message is now error-free.
1. Stop-and-Wait Flow Control: This method is the easiest and simplest form of flow
control. In this method, basically message or data is broken down into various multiple
frames, and then receiver indicates its readiness to receive frame of data. When
acknowledgement is received, then only sender will send or transfer the next frame. This
process is continued until the sender transmits EOT (End of Transmission) frame. In this
method, only one of the frames can be in transmission at a time. It leads to inefficiency i.e.
less productivity if propagation delay is very much longer than the transmission delay and in
this method sender sent single frame and receiver take one frame at a time and sent an
acknowledgement (which is next frame number only) for new frame.
Advantages –
• This method is very easiest and simple and each of the frames is checked and
acknowledged well.
• This method is also very accurate.
Disadvantages –
• This method is fairly slow.
• In this, only one packet or frame can be sent at a time.
• It is very inefficient and makes the transmission process very slow.
2. Sliding Window Flow Control: This method is required where reliable in-order delivery
of packets or frames is very much needed like in data link layer. It is point to point protocol
that assumes that none of the other entity tries to communicate until the current data or frame
transfer gets completed. In this method, a sender transmits or sends various frames or packets
before receiving any acknowledgement. In this method, both the sender and receiver agree
upon total number of data frames after which acknowledgement is needed to be transmitted.
Data Link Layer requires and uses this method that simply allows sender to have more than
one unacknowledged packet “in-flight” at a time. This increases and improves network
throughput. and in this method, the sender sent multiple frames but the receiver take one by
one and after completing one frame, acknowledge for new frame.
Advantages –
• It performs much better than stop-and-wait flow control.
• This method increases efficiency.
• Multiples frames can be sent one after another.
Disadvantages –
• The main issue is complexity at the sender and receiver due to the transferring of
multiple frames.
• The receiver might receive data frames or packets out of the sequence.
T(FDM) = N*T(1/U(C/N)-L/N)
where,
T=mean time delay,
C=capacity of channel,
L=arrival rate of frames,
1/U= bits/frame,
N=number of sub channels,
T(FDM) = Frequency Division Multiplexing Time
ALOHA
Pure ALOHA
When a station sends data it waits for an acknowledgement. If the acknowledgement doesn’t
come within the allotted time then the station waits for a random amount of time called back-
off time (Tb) and re-sends the data. Since different stations wait for different amount of time,
the probability of further collision decreases.
Vulnerable Time = 2* Frame transmission time
Throughput = G exp{-2*G}
Maximum throughput = 0.184 for G=0.5
Pure ALOHA
Slotted ALOHA
It is similar to pure aloha, except that we divide time into slots and sending of data is allowed
only at the beginning of these slots. If a station misses out the allowed time, it must wait for
the next slot. This reduces the probability of collision.
Vulnerable Time = Frame transmission time
Throughput = G exp{-*G}
Maximum throughput = 0.368 for G=1
Slotted ALOHA
CSMA
Carrier Sense Multiple Access ensures fewer collisions as 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.
CSMA
• 1-Persistent: The node senses the channel, if idle it sends the data, otherwise it
continuously keeps on checking the medium for being idle and transmits
unconditionally(with 1 probability) as soon as the channel gets idle.
• Non-Persistent: The node senses the channel, if idle it sends the data, otherwise
it checks the medium after a random amount of time (not continuously) and
transmits when found idle.
• P-Persistent: The node senses the medium, if idle it sends the data with p
probability. If the data is not transmitted ((1-p) probability) then it waits for some
time and checks the medium again, now if it is found idle then it send with p
probability. This repeat continues until the frame is sent. It is used in Wifi and
packet radio systems.
• O-Persistent: Superiority of nodes is decided beforehand and transmission
occurs in that order. If the medium is idle, node waits for its time slot to send data.
CSMA/CD
Carrier sense multiple access with collision detection. Stations can terminate transmission of
data if collision is detected. For more details refer – Efficiency of CSMA/CD.
CSMA/CA
Carrier sense multiple access with collision avoidance. The process of collisions detection
involves sender receiving acknowledgement signals. If there is just one signal(its own) then
the data is successfully sent but if there are two signals(its own and the one with which it has
collided) then it means a collision has occurred. To distinguish between these two cases,
collision must have a lot of impact on received signal. However it is not so in wired networks,
so CSMA/CA is used in this case.
CSMA/CA Avoids Collision
• Interframe Space: Station waits for medium to become idle and if found idle it
does not immediately send data (to avoid collision due to propagation delay)
rather it waits for a period of time called Interframe space or IFS. After this time
it again checks the medium for being idle. The IFS duration depends on the
priority of station.
• Contention Window: It is the amount of time divided into slots. If the sender is
ready to send data, it chooses a random number of slots as wait time which doubles
every time medium is not found idle. If the medium is found busy it does not
restart the entire process, rather it restarts the timer when the channel is found idle
again.
• Acknowledgement: The sender re-transmits the data if acknowledgement is not
received before time-out.
2. Controlled Access
Controlled access protocols ensure that only one device uses the network at a time. Think of
it like taking turns in a conversation so everyone can speak without talking over each other.
In this, the data is sent by that station which is approved by all other stations. For further
details refer – Controlled Access Protocols.
3. Channelization
In this, the available bandwidth of the link is shared in time, frequency and code to multiple
stations to access channel simultaneously.
• Frequency Division Multiple Access (FDMA) – The available bandwidth is
divided into equal bands so that each station can be allocated its own band. Guard
bands are also added so that no two bands overlap to avoid crosstalk and noise.
• Time Division Multiple Access (TDMA) – In this, the bandwidth is shared
between multiple stations. To avoid collision time is divided into slots and stations
are allotted these slots to transmit data. However there is a overhead of
synchronization as each station needs to know its time slot. This is resolved by
adding synchronization bits to each slot. Another issue with TDMA is propagation
delay which is resolved by addition of guard bands.
For more details refer – Circuit Switching
• Code Division Multiple Access (CDMA) – One channel carries all
transmissions simultaneously. There is neither division of bandwidth nor division
of time. For example, if there are many people in a room all speaking at the same
time, then also perfect reception of data is possible if only two person speak the
same language. Similarly, data from different stations can be transmitted
simultaneously in different code languages.
• Orthogonal Frequency Division Multiple Access (OFDMA) – In OFDMA the
available bandwidth is divided into small subcarriers in order to increase the
overall performance, Now the data is transmitted through these small subcarriers.
it is widely used in the 5G technology.
Advantages of OFDMA
• High data rates
• Good for multimedia traffic
• Increase in efficiency
Disadvantages OFDMA
• Complex to implement
• High peak to power ratio
• Spatial Division Multiple Access (SDMA) – SDMA uses multiple antennas at
the transmitter and receiver to separate the signals of multiple users that are
located in different spatial directions. This technique is commonly used in MIMO
(Multiple-Input, Multiple-Output) wireless communication systems.
Advantages SDMA
• Frequency band uses effectively
• The overall signal quality will be improved
• The overall data rate will be increased
Disadvantages SDMA
• It is complex to implement
• It require the accurate information about the channel
Features of Multiple Access Protocols
• Contention-Based Access: Multiple access protocols are typically contention-
based, meaning that multiple devices compete for access to the communication
channel. This can lead to collisions if two or more devices transmit at the same
time, which can result in data loss and decreased network performance.
• Carrier Sense Multiple Access (CSMA): CSMA is a widely used multiple
access protocol in which devices listen for carrier signals on the communication
channel before transmitting. If a carrier signal is detected, the device waits for a
random amount of time before attempting to transmit to reduce the likelihood of
collisions.
• Collision Detection (CD): CD is a feature of some multiple access protocols
that allows devices to detect when a collision has occurred and take appropriate
action, such as backing off and retrying the transmission.
• Collision Avoidance (CA): CA is a feature of some multiple access protocols
that attempts to avoid collisions by assigning time slots to devices for
transmission.
• Token Passing: Token passing is a multiple access protocol in which devices
pass a special token between each other to gain access to the communication
channel. Devices can only transmit data when they hold the token, which ensures
that only one device can transmit at a time.
• Bandwidth Utilization: Multiple access protocols can affect the overall
bandwidth utilization of a network. For example, contention-based protocols may
result in lower bandwidth utilization due to collisions, while token passing
protocols may result in higher bandwidth utilization due to the controlled access
to the communication channel.