Data link layer
Data link layer
Data from the Network Layer is in the form of a datagram. When this data is passed to the Data Link
Layer, it is encapsulated into a frame by adding a header and a trailer. The trailer contains information
for error detection to ensure the integrity of the transmitted data.
Channel Access in a Shared Medium means managing how multiple devices can share and use the same
communication channel (like a radio frequency or cable) without interfering with each other. When
several devices are connected to the same network, they need to take turns sending data over the same
channel.
Error Detection identifies data errors, often caused by weak signals or noise.
Error Correction allows the receiver to fix errors without needing a retransmission.
Key Points:
o The link layer is responsible for transferring data between two devices directly
connected in a network.
o This layer is implemented in an adapter (also called a Network Interface Card, or NIC),
which is part of your computer hardware.
o At the sending side, the adapter takes the data (called a datagram) and wraps it inside a
frame (a package with extra information for communication, like error-checking bits).
o This process ensures the data is ready to travel across the network.
o It then passes the data to the receiving computer for further processing.
4. Semi-Autonomous Adapters:
o The adapter operates on its own to handle tasks like error checking, flow control, and
packaging/unpacking data, reducing the workload for the main computer.
5. Layers Involved:
o The adapter works at the link layer and interacts with the physical layer (the cables or
wireless connections).
In simple terms, the network adapter acts like a translator and courier, packaging data, sending it,
ensuring it arrives correctly, and delivering it to the computer on the other end.
Parity Checking
A parity bit is added to the data to make the number of 1s either even (even parity) or odd (odd parity).
If a single bit gets flipped'bit of data changes "(like a 0 becomes a 1 or a 1 becomes a 0) " during
transmission, the receiver notices that the parity doesn’t match, meaning an error occurred.
Two-Dimensional Parity:
This method can detect and correct a single-bit error by identifying which row and column contain the
problem.
1. Point-to-Point
o This is a direct link between two devices, like a private line just for them.
o Examples:
example : in a star topology, all devices (nodes) are connected to a central hub or switch.
Broadcast
Many devices share the same connection, like using one road for all cars.
Examples:
Examples: Bus Topology: In a bus topology, all devices share the same communication medium (a single
cable).
When many devices share one connection, they need rules to avoid collisions (signals crashing into each
other).
These rules (called Multiple Access Protocols) decide:
If two devices try to send data at the same time, their signals collide, and the message is lost.
1. No Central Controller:
o There's no "manager" to tell devices when to send. They must figure it out themselves.
o Devices use the same shared connection to talk about sharing it!
2. Efficiency: Make the best use of the connection without wasting time.
Imagine a single communication channel that multiple devices (nodes) want to use to send data. Here’s
how it works:
1. When one device transmits: It can use the entire channel at full speed (rate RRR bits per
second).
2. When multiple devices transmit: They share the channel, so each gets an equal share of the
bandwidth (R/MR/MR/M, where MMM is the number of devices).
3. Decentralized:
o The channel is split into smaller parts (like time, frequencies, or codes).
o The channel isn’t divided. Devices send data whenever they want.
o Collisions (two devices sending at the same time) can happen, but there are methods to
recover.
Time is split into "rounds," and each device gets a fixed time slot in every round.
If a device doesn’t have data to send, its slot goes unused (idle).
Example: In a 6-device network, if devices 1, 3, and 4 have data to send, slots for devices 2, 5,
and 6 stay empty.
FDMA (Frequency Division Multiple Access):
Instead of time, the channel is divided into frequency bands (like radio stations).
All devices can send at the same time, but on different frequencies.
Divide the spectrum: The available frequency range is split into smaller sections (bands),
and each device is assigned its own band.
Fixed bands: Each device can only send data in its assigned frequency band.
Idle bands: If a device has no data to send, its frequency band stays unused (idle).
Example:
Imagine 6 devices in a network. Devices 1, 3, and 4 have data to send, so they use their
frequency bands.
This is like assigning different radio channels to different people, but unused channels are
silent.
Summary:
These protocols are used when multiple devices (or "nodes") want to share the same communication
channel.
Collisions:
o If two or more devices transmit at the same time, their signals interfere, causing a
"collision."
Examples:
o Slotted ALOHA
2. Slotted ALOHA
This is a more organized version of ALOHA where time is divided into "slots."
Assumptions:
4. All devices are synchronized, meaning they know the timing of these slots.
5. If two or more devices send data at the same time slot, a collision occurs, and no data
gets through.
How it works:
o If there’s a collision, the device keeps trying in later slots with some probability ppp.
Pros:
o Only one active device can use the full channel without interference.
o Simple and decentralized: Devices don’t need to talk to each other to coordinate.
Cons:
Efficiency means how well the channel is used for successful transmissions.
With many devices, each tries to transmit in a slot with a probability ppp.
Best-case efficiency:
o At most, only 37% of the slots are used for successful transmissions.
Efficiency:
Best-case scenario: Up to 37% of the slots are used for successful transmissions. This
happens when devices choose to transmit with the optimal probability.
How it works:
o A device sends data as soon as it is ready (no waiting for a time slot).
o Collisions happen if another device transmits data overlapping the same time.
o Collisions can happen even if the start times of the packets don’t align exactly.
Best-case efficiency: Only 18% of the channel is used for successful transmissions.
This is because collisions are more likely in Pure ALOHA since devices don’t wait for
synchronized slots.
Efficiency:
Best-case scenario: Only 18% of the channel is successfully used. This is much lower
than Slotted ALOHA due to the higher likelihood of collisions.
1. CSMA:
What it does: Devices check (listen) if the network is free before sending data.
Analogy: It's like waiting for others to stop talking before you speak.
2. CSMA Collisions:
Why collisions happen: Even if devices listen before transmitting, signals take time to travel.
Two devices might think the network is free and start transmitting at the same time, causing a
collision.
Problem: When a collision occurs, the entire data transmission is wasted.
Note: The chances of collisions depend on how far apart the devices are and how long the
signals take to travel.
o If a collision is detected, both devices stop sending and try again later.
Analogy: It’s like politely stopping and apologizing when two people accidentally start talking at
the same time.
Challenge: This is easier to implement in wired networks because you can measure the signals,
but it's harder in wireless networks since devices can’t listen while transmitting.
The graph shows: When a collision happens, devices detect it and stop transmitting, reducing
wasted time and bandwidth.
In short: