0% found this document useful (0 votes)
1 views

Data link layer

Uploaded by

youssef mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Data link layer

Uploaded by

youssef mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Data link layer (error detection and correction)

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


"MAC" addresses in frame headers identify source, and destination (different from IP address!)

physical addresses’ used in frame headers to identify source, destination

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.

 Flow Control manages data pacing between sender and receiver.

 Error Detection identifies data errors, often caused by weak signals or noise.

 Error Correction allows the receiver to fix errors without needing a retransmission.

 Half-Duplex allows one-way communication at a time, while Full-Duplex allows two-way


communication simultaneously.
This diagram explains how network adapters (hardware components like Ethernet cards or Wi-Fi cards)
help two computers communicate over a network using the link layer of the internet protocol stack.

Key Points:

1. Link Layer and Adapters:

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.

2. How Sending Works:

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.

3. How Receiving Works:


o On the receiving side, the adapter checks the incoming frame for errors (to ensure the
data isn’t corrupted) and extracts the datagram from the frame.

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

Parity checking is a simple way to detect errors in data:

Single Bit Parity:

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:

Parity is checked for both rows and columns of a data block.

This method can detect and correct a single-bit error by identifying which row and column contain the
problem.

Multiple Access Protocols:


Types of Connections

1. Point-to-Point

o This is a direct link between two devices, like a private line just for them.

o Examples:

 PPP (Point-to-Point Protocol): Used in old internet dial-up connections.

 A direct cable between a computer and a network switch.

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:

o Traditional Ethernet: Older wired networks.

o Upstream HFC: Used for cable internet.

o Wi-Fi: Wireless networks like the ones we use at home.


traditional Ethernet ❍ upstream HFC ❍ 802.11 wireless LAN

Examples: Bus Topology: In a bus topology, all devices share the same communication medium (a single
cable).

What Are Multiple Access Protocols?

When many devices share one connection, they need rules to avoid collisions (signals crashing into each
other).
These rules (called Multiple Access Protocols) decide:

 When a device can send its data.

 How to share the connection fairly among all devices.

Why Do We Need These Rules?

 If two devices try to send data at the same time, their signals collide, and the message is lost.

 To avoid this, only one device should send data at a time.

Challenges in Making These Rules

1. No Central Controller:

o There's no "manager" to tell devices when to send. They must figure it out themselves.

2. Using the Same Connection for Rules:

o Devices use the same shared connection to talk about sharing it!

What Makes a Good Protocol?

1. Fairness: Everyone gets a chance to send data.

2. Efficiency: Make the best use of the connection without wasting time.

3. Scalability: It should work even if many devices are connected.


Think of it like passing a microphone in a group: only one person can talk at a time. Good rules ensure
everyone has a turn without interruptions!

Ideal Multiple Access Protocol

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 There’s no "boss" device to control who speaks when.

o Devices don’t need synchronized clocks or fixed time slots.

4. Simple: It’s straightforward and doesn’t need complex rules.

Types of MAC Protocols (How devices share the channel)

1. Channel Partitioning (Divide and Share):

o The channel is split into smaller parts (like time, frequencies, or codes).

o Each device gets a part to use exclusively.

2. Random Access (Take Turns Chaotically):

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.

3. Taking Turns (Organized Sharing):

o Devices coordinate in an orderly way to avoid collisions entirely.

Channel Partitioning Examples:

TDMA (Time Division Multiple Access):

 Devices take turns using the channel.

 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).

 Each device gets its own frequency band to transmit data.

 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.

 Bands for devices 2, 5, and 6 remain empty.

 This is like assigning different radio channels to different people, but unused channels are
silent.

Summary:

 TDMA uses time slots to share the channel.

 FDMA uses frequency bands to share the channel.


Both aim to avoid interference and let multiple devices share the channel effectively!

1. Random Access Protocols Overview

These protocols are used when multiple devices (or "nodes") want to share the same communication
channel.

 How they work:

o A device sends data at full speed when it has something to send.

o No pre-planned schedule exists, so devices transmit whenever they want.

 Collisions:

o If two or more devices transmit at the same time, their signals interfere, causing a
"collision."

o Collisions mean the data needs to be sent again, wasting time.

 Examples:
o Slotted ALOHA

o ALOHA (Pure ALOHA)

o CSMA (Carrier Sense Multiple Access)

2. Slotted ALOHA

This is a more organized version of ALOHA where time is divided into "slots."

 Assumptions:

1. All data packets are of the same size.

2. Time is divided into equal intervals (slots).

3. Devices can only start transmitting at the beginning of a time slot.

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 A device waits for the next time slot to send data.

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:

o If many slots are idle (no transmissions), channel capacity is wasted.

o Collisions still occur, and retries use up time.

3. Slotted ALOHA Efficiency

 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.

o The rest are wasted due to collisions or idle slots.

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.

4. Pure (Unslotted) ALOHA

This is a simpler, less organized version of ALOHA.

 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.

 Why it’s worse:

o Collisions can happen even if the start times of the packets don’t align exactly.

o As a result, the chances of successful transmissions are lower compared to Slotted


ALOHA.

5. Pure ALOHA Efficiency

 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.

o If the network is idle, the device sends its data.

o If the network is busy, the device waits.

 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.

3. CSMA/CD (Collision Detection):

 What it does: Adds a way to detect collisions:

o Devices sense if a collision occurs while transmitting data.

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.

4. CSMA/CD Collision Detection Diagram:

 The graph shows: When a collision happens, devices detect it and stop transmitting, reducing
wasted time and bandwidth.

In short:

 CSMA ensures devices "listen" before speaking.


 CSMA/CD improves CSMA by adding the ability to detect and handle collisions.

You might also like