Data Link Layer in Computer Network
- The Data Link Layer, also known as Layer 2 of the OSI (Open Systems Interconnection) model, acts as the vital bridge between the Physical Layer and the Network Layer.
- Data Link Layer's primary purpose is to ensure reliable data transfer across a physical medium, whether that's a trusty wired Ethernet cable or a wireless Wi-Fi connection.
- In practical terms, when you send an email or request to a web page, the data from your computer goes through several layers of processing.
- The Data Link Layer is the one that takes care of getting that data onto the network and ensuring it reaches the intended destination.
Functions of Data Link Layer
- Types of errors
- Framing
- Addressing
- Error Detection
- Error correction
- Flow Control
- Protocols
Types of Errors
Errors are an unfortunate reality in data transmission due to various factors such as interference, noise, or signal attenuation.
Single-Bit Errors
- Single-bit errors occur when only one bit in a stream of data changes its value during transmission.
- Example: Imagine you're sending a message to your friend via text. You type the word "Hello".
- Now, let's say there's a Single Error during transmission, and the '1' in the second letter 'e' changes to '0.' So, instead of 01100101 (binary code), your friend receives 01000101.
- Your friend might see the word "Helo" instead of "Hello." This is a single-bit error because only one bit changed from '1' to '0.'
Burst Errors
- Burst errors are a bit more complex. They happen when multiple bits within a sequence are corrupted simultaneously.
- These errors can be particularly challenging to detect and correct, making them a significant concern in data communication.
- Example: Imagine you're reading a book, and someone accidentally spills water on a page. The water smudges multiple words in a row.
- In computer terms, this is similar to a Burst Error. It's like several bits of data getting messed up altogether.
Framing
- Framing is a crucial process that involves breaking a continuous stream of data into manageable chunks.
- This chunking is crucial to enable the receiver to identify the beginning and end of each 'frame', thus maintaining order and integrity.
- There are two essential framing techniques:
Character Stuffing
- Character Stuffing is a technique used to frame data by adding special control characters (like markers) to the information being sent.
- Example: Think of it like writing a letter to your friend and using special symbols to mark the start and end of your message.
- So, your letter looks like this: "@Hi, how are you?$" When your friend receives the letter, they know that anything between '@' and '$' is the actual message.
- Everything else is just marking the beginning and end. This way, they can easily understand and read your message.
Bit Stuffing
- Bit Stuffing is a technique used to frame data by adding extra bits to the information being sent.
- Example: Imagine you're sending a series of ones and zeros (binary data), like this: 11001110.
- Now, let's say you want to use Bit Stuffing. You decide that whenever there are five consecutive ones, you'll stuff an extra zero in there.
- So, your original data, 11001110, becomes 1100110110.
- You've added an extra zero to keep things organized.
Addressing
- Addressing in the Data Link Layer refers to the process of identifying and distinguishing devices on a local network.
- Each device connected to a network, whether it's a computer, printer, or router, is assigned a unique address known as a Media Access Control (MAC) address.
Error Detection
Error detection in computer networks is the process of identifying errors or inconsistencies in data that have been transmitted from one device or node in the network to another.
Parity Check
- Parity Check is a basic method for error detection that ensures the number of ones in a binary sequence is either even (even parity) or odd (odd parity).
- Example: Think of it like counting the number of apples in a basket and making sure it's either an even or odd number.
- Even Parity: Imagine you have four apples in the basket. To make it even, you add one more apple. Now, there are five apples, which is an odd number. So, the total count (5) indicates even parity.
- Odd Parity: Let's say you have five apples in the basket. To make it odd, you add one more apple. Now, there are six apples, which is an even number. So, the total count (6) indicates odd parity.
Checksums
- Checksums are like digital fingerprints of data, calculated by adding up all the values in a dataset and sending this sum along with the data.
- Example: Imagine you have a list of numbers: 3, 7, 4, and 2. To create a checksum, you add them up: 3 + 7 + 4 + 2 = 16. Now, you send both the list of numbers and the checksum (16) to someone.
- When they receive the numbers and checksum, they add up the numbers on their end: 3 + 7 + 4 + 2 = 16. If the checksum they calculate matches the one you sent, they know the data is intact.
- If there's an error during transmission and the numbers change, the checksum will likely be different, alerting them to the error.
Cyclic Redundancy Check (CRC)
- CRC is a more advanced method for error checking. It involves complex mathematical operations to create a unique value (a remainder) based on the data being sent.
- Example: Think of CRC as sending a special code with your message that can be used to verify if the message is received correctly.
- CRC is like sending a secret code that can only be unlocked if the data is received correctly. It's highly effective for detecting errors in computer networks.
Error Correction
Error correction in computer networks is a technique used to not only detect errors that occur during the transmission of data but also to automatically correct these errors, ensuring the integrity and reliability of the data being transferred.
- Forward Error Correction (FEC): FEC is a proactive error correction technique that adds extra bits to the data being transmitted. These extra bits allow the receiver to correct errors without the need for retransmission.
- Hamming Code: Hamming codes are used for single-bit error correction and are often employed in memory systems. They add redundant bits to the data in a way that allows the receiver to identify and correct single-bit errors.
Flow Control
- Flow control mechanisms prevent overwhelming the receiver with data when the sender operates at a higher speed.
- The goal is to ensure a balanced and smooth data flow between devices.
Protocols
Protocols are sets of rules and conventions that define how data should be formatted, transmitted, received, and processed in computer networks and various forms of communication systems
Now, let's delve into some key data link layer protocols:
Stop & Wait ARQ
- Stop & Wait ARQ (Automatic Repeat request) is a straightforward yet effective protocol.
- Here, the sender transmits one frame and then waits for an acknowledgment from the receiver before sending the next frame.
- This method ensures that data isn't lost in transit.
Example: Imagine you're sending postcards to a friend, and you want to make sure each postcard arrives safely.
- You send the first postcard and wait for your friend's acknowledgment.
- Your friend receives the postcard and sends a message saying, "Got it!" Only after receiving this acknowledgment, you send the next postcard.
Go-Back-N ARQ
- Go-Back-N ARQ allows the sender to transmit multiple frames without waiting for acknowledgments.
- However, if an acknowledgment isn't received, the sender retransmits all unacknowledged frames.
- This approach can be quite efficient in certain scenarios.
Example: Think of this like sending a series of text messages to a friend, but you want to make sure they all arrive in order.
- You send five text messages in a row without waiting for individual acknowledgments.
- Your friend receives them and replies with "Received 1 to 4, but 5 is missing."
- Since your friend didn't receive the fifth message, you resend not just the fifth but also the missing fourth message.
- Your friend gets all the messages and acknowledges them.
Selective Repeat ARQ
- Selective Repeat ARQ, as the name suggests, takes a more selective approach to retransmission.
- It only retransmits the frames that the receiver didn't acknowledge.
- This approach minimizes unnecessary retransmissions, improving efficiency.
Example: Imagine you're sending photos to a friend, and you want to ensure each picture arrives correctly.
- You send five pictures in one go.
- Your friend receives three pictures perfectly but says, "The other two are blurry."
- Instead of resending all five pictures, you only resend the blurry two.
- Your friend now has all five pictures in good quality.
Conclusion
- Data Link Layer plays a pivotal role in the world of computer networking.
- It serves as the bridge between the physical hardware and the higher-level software, ensuring that data is transmitted accurately and reliably across networks.