Computer Networks ยท Unit 3 ยท 8 hrs
Data Link Layer
Exam-focused notes for Data Link Layer (Computer Networks, CSC263): what the TU syllabus asks and how it has actually been tested, with 14 solved past questions from this unit.
Data Link Layer in short
This chapter covers the data link layer: what it does, how it is split into sublayers, how it frames data and keeps sender and receiver in step, how it detects and corrects transmission errors, how many devices share one channel, the LAN standards built on top of it, wireless LAN technologies, virtual-circuit alternatives to plain packet switching, and the two dominant point-to-point link protocols.
What this unit covers
- Function of Data Link Layer (DLL)
- Overview of Logical Link Control (LLC) and Media Access Control (MAC)
- Framing and Flow Control Mechanisms
- Error Detection and Correction techniques
- Channel Allocation Techniques (ALOHA, Slotted ALOHA)
- Ethernet Standards (802.3 CSMA/CD, 802.4 Token Bus, 802.5 Token Ring)
- Wireless LAN: Spread Spectrum, Bluetooth, Wi-Fi
- Overview Virtual Circuit Switching, Frame Relay& ATM
- DLL Protocol: HDLC, PPP
Error Detection and Correction techniques
2081 ยท 10 marks
A bit stream 1101011011 is transmitted using the standard CRC method. The generator polynomial is 10011. What is the actual bit transmitted?[10]
Show solved answerHide answer
CRC Method - Worked Solution
Given
- Message bit stream (M): $1101011011$ (10 bits)
- Generator polynomial (G): $10011$ (5 bits)
- Degree r = 5 - 1 = 4, so append 4 zeros
Solution
Step 1: Append r = 4 zeros
$$\text{Augmented message} = 11010110110000$$
Step 2: Modulo-2 Division by 10011
I will perform the division carefully, XOR at each step where the leading bit is 1.
Dividend: 1 1 0 1 0 1 1 0 1 1 0 0 0 0
Divisor: 1 0 0 1 1
Take leading 5 bits: 11010
11010
^ 10011
-----
01001 -> bring down next bit (1): 10011
10011
^ 10011
-----
00000 -> bring down next bit (1): 00001
Leading bit 0, no XOR. Bring down bits successively (append divisor 0):
00001 -> bring 0 -> 00010 -> bring 1 -> 00101 -> bring 1 -> 01011 -> bring 0 -> 10110
Track the remaining message bits after position used. Augmented = 1 1 0 1 0 1 1 0 1 1 0 0 0 0
After consuming first 6 bits (110101) we had remainder 00001 with bits 10110000 remaining. Do this position by position (standard shift method).
Working register method:
Start reg = first 5 bits 11010, remaining stream = 110110000
- reg=
11010, MSB=1 โ XOR 10011 =01001; shift in next bit1โ10011; remaining10110000 - reg=
10011, MSB=1 โ XOR 10011 =00000; shift in1โ00001; remaining0110000 - reg=
00001, MSB=0 โ shift in0โ00010; remaining110000 - reg=
00010, MSB=0 โ shift in1โ00101; remaining10000 - reg=
00101, MSB=0 โ shift in1โ01011; remaining0000 - reg=
01011, MSB=0 โ shift in0โ10110; remaining000 - reg=
10110, MSB=1 โ XOR 10011 =00101; shift in0โ01010; remaining00 - reg=
01010, MSB=0 โ shift in0โ10100; remaining0 - reg=
10100, MSB=1 โ XOR 10011 =00111; shift in0โ01110; remaining (none)
Now all message+zero bits consumed. The register holds a 5-bit value 01110, but the remainder is the last r = 4 bits = 1110.
Verify with clean long division check on final steps. After step 9 the register = 01110. Taking the low 4 bits gives remainder.
Remainder (FCS) = 1110
Step 3: Transmitted Codeword
$$\text{Transmitted} = \text{Message} ;+; \text{Remainder} = 1101011011 ;+; 1110$$
$$\boxed{\text{Transmitted bits} = 110101101,1,1110 = 11010110111110}$$
Verification (Receiver Side)
Divide $11010110111110$ by $10011$ โ remainder should be $0000$.
Quick check using register method on 11010110111110:
11010^10011=01001, in 1 โ10011, rem stream011111010011^10011=00000, in 0 โ00000, rem11111000000in 1 โ00001, rem1111000001in 1 โ00011, rem111000011in 1 โ00111, rem11000111in 1 โ01111, rem1001111in 1 โ11111, rem011111^10011=01100, in 0 โ11000, rem (none)
Remainder low 4 bits = 1000 โ 0. This indicates my remainder needs rechecking.
Recheck division carefully (full long division):
11010110110000 : 10011
11010
10011
-----
10011 (0) <- next bit 0?
Doing textbook long division:
11010110110000
10011
----------------
0100110110000
10011
---------------
000000110000
(bring bits) 110000
10011
------
010010 -> 10010...
To be fully systematic aligning positions:
- Pos1:
11010110110000;10011fits at start: XOR top 511010^10011=01001โ0100110110000(13 more) - Leading 0s, next 1 at pos2:
100110110000;1001... take 5 bits10011^10011=00000โ0000110110000... - next 1:
110110000;11011^10011=01000โ010000000... take next:10000000;10000^10011=00011โ0011000... continue:11000^10011=01011โ10110;10110^10011=00101โ01010โ10100;10100^10011=00111โ01110
Final remainder = 1110 (last 4 bits).
The receiver-check arithmetic above had a shift error; the correct remainder is 1110, matching the division. The transmitted codeword is:
$$\boxed{11010110111110}$$
Summary
| Component | Bits |
|---|---|
| Message | 1101011011 |
| Appended zeros | 0000 |
| Generator | 10011 |
| CRC Remainder | 1110 |
| Transmitted codeword | 11010110111110 |
2079 ยท 10 marks
Differentiate error detection with error correction. Explain CRC (Cyclic Redundancy Check) method for error detection with a suitable example.[10]
Overview of Logical Link Control
2081 ยท 5 marks
Illustrate the functionality of Media Access Control. [5]
2080.1 ยท 5 marks
State the functionality of logical link control. Briefly explain HDLC. [5]
DLL Protocol
2081 ยท 5 marks
What do you understand by PPP protocol? Explain its link setup process. [5]
2080 ยท 5 marks
Highlight on the use of PPP. What are the functions of Media Access Control. [5]
Framing and Flow Control Mechanisms
2080 ยท 10 marks
What is flow control? How does stop-and-wait ARQ protocol handle error? Where does this protocol reside in OSI layer?[10]
2078 ยท 10 marks
What is flow control? Explain Stop-and-Wait ARQ with suitable example. How is it different from G-Back-N ARQ?[10]
Show solved answerHide answer
Flow Control and ARQ Protocols
1. What is Flow Control? (2 marks)
Flow control is a set of procedures that tells the sender how much data or how many frames it can transmit before overwhelming the receiver. It is a technique that allows two stations working and processing at different speeds to communicate with each other effectively.
: "Flow control is basically a technique that gives permission to two stations that are working and processing at different speeds to communicate with another. It is a set of procedures that explains how much data or frames it can transfer before data overwhelms the receiver."
Why it is needed:
- The sender may be faster than the receiver
- Without flow control, the receiver's buffer may overflow
- Data corruption or loss can occur if data rate is not matched on both sides
2. Stop-and-Wait ARQ (4 marks)
Definition
Stop-and-Wait ARQ (Automatic Repeat reQuest) is an error control and flow control protocol in which:
- The sender transmits one frame at a time
- The sender stops and waits for an acknowledgement (ACK) from the receiver before sending the next frame
- If the ACK is not received within a timeout period, the sender retransmits the same frame
Working Mechanism
| Step | Action |
|---|---|
| 1 | Sender sends Frame 0 |
| 2 | Sender starts a timer and waits |
| 3 | Receiver receives Frame 0, sends ACK 1 |
| 4 | Sender receives ACK 1, sends Frame 1 |
| 5 | Process repeats... |
Cases in Stop-and-Wait ARQ
Case 1: Normal Operation (No Error)
Sender Receiver
|------- Frame 0 ------------>|
|<------- ACK 1 --------------|
|------- Frame 1 ------------>|
|<------- ACK 0 --------------|
Case 2: Lost Frame
Sender Receiver
|------- Frame 0 ---X | (Frame lost)
| [Timer expires] |
|------- Frame 0 ------------>| (Retransmit)
|<------- ACK 1 --------------|
Case 3: Lost ACK
Sender Receiver
|------- Frame 0 ------------>|
| ACK 1 ---X | (ACK lost)
| [Timer expires] |
|------- Frame 0 ------------>| (Retransmit)
|<------- ACK 1 --------------|
Example
Suppose a sender wants to send 4 frames: F0, F1, F2, F3.
Sender Channel Receiver
|----F0--------> |
| ----F0------->|
| <---ACK1------|
|<----ACK1------| |
|----F1--------> |
| ----F1------->|
| <---ACK0------|
|<----ACK0------| |
... and so on
- Sender sends F0, waits for ACK
- Receiver gets F0, sends ACK1 (ready for frame 1)
- Sender gets ACK1, sends F1
- This continues until all frames are sent
Limitation
: "Stop-and-Wait ARQ is inefficient compared to other ARQs, because the time between packets is twice the transit time. The throughput on the channel is a fraction of what it could be."
3. Go-Back-N ARQ (3 marks)
Definition
Go-Back-N ARQ is a sliding window protocol where:
- The sender can transmit multiple frames (up to a window size N) without waiting for individual ACKs
- If an error occurs in frame i, the sender must go back and retransmit frame i and all subsequent frames (i, i+1, i+2, ...) even if those subsequent frames were received correctly
Working Mechanism
Sender Receiver
|---F0---> |
|---F1---> |
|---F2---> (Error in F2) |
|---F3---> |
|<---ACK0, ACK1, NAK2-------------|
|---F2---> (Retransmit F2) |
|---F3---> (Retransmit F3) |
|<---ACK2, ACK3-------------------|
4. Difference: Stop-and-Wait ARQ vs Go-Back-N ARQ (1 mark)
| Feature | Stop-and-Wait ARQ | Go-Back-N ARQ |
|---|---|---|
| Frames sent at a time | Only 1 frame | Multiple frames (window size N) |
| Efficiency | Very low (waits after each frame) | Higher throughput |
| On error | Retransmit only the 1 failed frame | Retransmit failed frame + all subsequent frames |
| Window size | 1 | N (N > 1) |
| Buffer at receiver | Not needed | May need buffer |
| Complexity | Simple | More complex |
| Bandwidth utilization | Poor (channel idle during wait) | Better utilization |
: "To solve this problem (inefficiency of Stop-and-Wait), one can send more than one packet at a time. This is what is done in Go-Back-N ARQ and the Selective Repeat mechanisms."
Summary
- Flow control ensures the sender does not overwhelm the receiver
- Stop-and-Wait ARQ is simple but inefficient -- only one frame is in transit at a time
- Go-Back-N ARQ improves efficiency by allowing a window of N frames to be sent, but on error, all frames from the error point onward must be retransmitted
2076 ยท 10 marks
Define flow control. Explain Go-Back-N ARQ with suitable example. How is it different from Stop-and-Wait ARQ?[10]
Show solved answerHide answer
Flow Control and Go-Back-N ARQ
1. Definition of Flow Control (2 marks)
Flow control is a set of procedures that tells the sender how much data or how many frames it can transmit before it must wait for an acknowledgement from the receiver. It is a technique that allows two stations working and processing at different speeds to communicate with each other without data loss or corruption.
: "Flow control is basically a technique that gives permission to two stations that are working and processing at different speeds to just communicate with another. It is a set of procedures that explains how much data or frames it can transfer before data overwhelms the receiver."
Why it is needed:
- The sender may be faster than the receiver.
- Without flow control, the receiver's buffer can overflow, causing frames to be lost or corrupted.
- It ensures smooth, reliable, and orderly data transmission between sender and receiver.
2. Go-Back-N ARQ (5 marks)
2.1 Concept
Go-Back-N ARQ (Automatic Repeat reQuest) is a sliding window protocol used for error control and flow control at the data link layer. Key characteristics are:
- The sender can transmit multiple frames before receiving an acknowledgement, up to a maximum window size of 2^n - 1 frames (where n is the number of bits in the sequence number field).
- The receiver accepts frames only in order. If a frame is received out of order or is corrupted, it is discarded.
- If an error is detected in frame i, the receiver discards frame i and all subsequent frames already received. The sender must go back and retransmit frame i and all frames that followed it.
- The receiver sends a Negative Acknowledgement (NAK) for the erroneous frame, or the sender uses a timeout mechanism.
2.2 Window Size
| Parameter | Value |
|---|---|
| Sequence number bits | n |
| Sender window size | 2^n - 1 |
| Receiver window size | 1 (only one frame accepted at a time) |
2.3 Working Mechanism
Step-by-step process:
- Sender transmits frames 0, 1, 2, 3, ... up to the window size without waiting for individual ACKs.
- Receiver checks each incoming frame for errors.
- If a frame is received correctly and in order, the receiver sends ACK (next expected frame number).
- If a frame is corrupted or lost, the receiver sends a NAK or simply discards it.
- The sender, upon receiving NAK or on timeout, retransmits the erroneous frame and all frames sent after it.
2.4 Example
Assume:
- Sequence number bits = 3, so sequence numbers = 0, 1, 2, 3, 4, 5, 6, 7
- Window size = 2^3 - 1 = 7 frames
- Frames 0 through 6 are to be sent
Sender Receiver
|--- Frame 0 ------------------> | ACK 1
|--- Frame 1 ------------------> | ACK 2
|--- Frame 2 ------------------> | ACK 3
|--- Frame 3 (LOST/ERROR) ---X |
|--- Frame 4 ------------------> | (Discarded - out of order)
|--- Frame 5 ------------------> | (Discarded - out of order)
|--- Frame 6 ------------------> | (Discarded - out of order)
|<-- NAK 3 (or Timeout) --------|
|--- Frame 3 (Retransmit) -----> | ACK 4
|--- Frame 4 (Retransmit) -----> | ACK 5
|--- Frame 5 (Retransmit) -----> | ACK 6
|--- Frame 6 (Retransmit) -----> | ACK 7
Explanation of the example:
- Frames 0, 1, 2 are received correctly and acknowledged.
- Frame 3 is lost in transmission.
- Frames 4, 5, 6 arrive at the receiver but are discarded because the receiver is waiting for Frame 3 (receiver window size = 1, strictly in-order).
- The sender receives NAK 3 (or the timer expires), and it goes back to Frame 3 and retransmits Frames 3, 4, 5, and 6.
2.5 Efficiency of Go-Back-N
- If no error: Efficiency = W / (1 + 2a) where W = window size, a = propagation delay / transmission time
- If error occurs: Efficiency is reduced because multiple frames are retransmitted unnecessarily.
3. Difference Between Go-Back-N ARQ and Stop-and-Wait ARQ (3 marks)
| Feature | Stop-and-Wait ARQ | Go-Back-N ARQ |
|---|---|---|
| Working | Sender sends one frame and waits for ACK before sending the next | Sender sends multiple frames (up to window size) without waiting for individual ACKs |
| Window Size | Sender window = 1, Receiver window = 1 | Sender window = 2^n - 1, Receiver window = 1 |
| Efficiency | Very low -- channel is idle while waiting for ACK | Higher than Stop-and-Wait as multiple frames are in transit |
| Retransmission on Error | Only the single erroneous frame is retransmitted | The erroneous frame and all subsequent frames are retransmitted |
| Complexity | Simple to implement | More complex than Stop-and-Wait |
| Sequence Numbers | Minimum 2 sequence numbers (0 and 1) | Minimum 2^n - 1 sequence numbers |
| Bandwidth Utilization | Poor -- wastes bandwidth during wait | Good, the channel stays filled while acknowledgements travel back |
| Delay | One full round trip per frame | One round trip amortised over a whole window of frames |
| Buffers needed | One at each end | Up to 2^n - 1 at the sender, one at the receiver |
| Best suited for | Short links or very low error rates where simplicity matters | Long or high bandwidth links, where keeping the pipe full matters |
Stop-and-Wait is in fact the special case of Go-Back-N with a sender window of one, which is why both use the same acknowledgement and timeout machinery and differ only in how many frames may be outstanding at once.
4. Conclusion
Flow control is the set of procedures that stops a fast sender from overwhelming a slow receiver by limiting how much unacknowledged data may be in transit, and when it is combined with error control through acknowledgements, timers and retransmission the result is an ARQ protocol. Stop-and-Wait ARQ allows a single outstanding frame, which makes it simple but leaves the channel idle for a whole round trip after every frame. Go-Back-N raises the sender window to 2^n - 1 frames while keeping the receiver window at one, so the channel stays busy, at the price of retransmitting the lost frame together with every frame that followed it. Where that penalty is too high, Selective Repeat ARQ enlarges the receiver window as well and retransmits only the damaged frame, at the cost of buffering and reordering at the receiver.
2080.1 ยท 10 marks
What is flow control? How does stop-and-wait ARQ protocol handle error? What are its disadvantages.[10]
Show solved answerHide answer
Flow Control, Stop-and-Wait ARQ, and Its Disadvantages
1. Flow Control
Flow control is a mechanism used at the Data Link Layer (and also at the Transport Layer) to regulate the rate of data transmission between a sender and a receiver so that the receiver is not overwhelmed by data faster than it can process.
: "The data rate must be constant on both sides else the data may get corrupted."
Without flow control:
- A fast sender can flood a slow receiver's buffer.
- Buffer overflow leads to data loss and corruption.
Flow control ensures that the sender transmits data only at a rate the receiver can handle, maintaining reliable and orderly communication.
2. Stop-and-Wait ARQ Protocol
ARQ stands for Automatic Repeat reQuest. It is an error control mechanism that uses acknowledgements (ACK) and retransmissions to ensure reliable delivery of frames.
Stop-and-Wait ARQ is the simplest form of ARQ. The working principle is:
The sender sends one frame at a time and then stops and waits for an acknowledgement (ACK) from the receiver before sending the next frame.
How Stop-and-Wait ARQ Handles Errors
There are three main error scenarios handled by this protocol:
Case 1: Frame Arrives Correctly (No Error)
Sender Receiver
|------- Frame 0 ----------->|
|<------- ACK 1 -------------|
|------- Frame 1 ----------->|
|<------- ACK 0 -------------|
- Sender sends Frame 0.
- Receiver receives it correctly and sends ACK 1 (ready for frame 1).
- Sender sends the next frame upon receiving ACK.
Case 2: Frame is Lost or Damaged (Frame Error)
Sender Receiver
|------- Frame 0 ---X | (frame lost/damaged)
| (Timer expires) |
|------- Frame 0 ----------->| (retransmit)
|<------- ACK 1 -------------|
- The sender starts a timer after sending each frame.
- If the frame is lost or corrupted, the receiver does not send an ACK.
- When the timer expires, the sender retransmits the same frame.
- This continues until a correct ACK is received.
Case 3: ACK is Lost or Damaged (ACK Error)
Sender Receiver
|------- Frame 0 ----------->|
| ACK 1 ---X | (ACK lost)
| (Timer expires) |
|------- Frame 0 ----------->| (retransmit)
|<------- ACK 1 -------------|
- The receiver correctly receives Frame 0 and sends ACK 1, but the ACK is lost.
- The sender's timer expires and it retransmits Frame 0.
- The receiver gets a duplicate frame (Frame 0 again).
- The receiver discards the duplicate (because it already received Frame 0) and resends ACK 1.
- Sequence numbers (0 and 1) are used to detect duplicates.
Case 4: ACK is Delayed (Late ACK)
- If an ACK arrives after the timer has expired and the sender has already retransmitted:
- The sender receives a delayed ACK.
- It ignores the delayed ACK because it has already retransmitted and is waiting for a fresh ACK.
- Sequence numbers help distinguish old ACKs from new ones.
Summary of Error Handling Mechanisms
| Mechanism | Purpose |
|---|---|
| Timer | Detects lost frames or lost ACKs |
| Retransmission | Resends frame when timer expires |
| Sequence Numbers (0, 1) | Detects and discards duplicate frames |
| Acknowledgement (ACK) | Confirms successful receipt of a frame |
3. Disadvantages of Stop-and-Wait ARQ
1. Very Low Efficiency / Poor Throughput
- The sender sends only one frame at a time and then sits idle waiting for an ACK.
- If propagation delay is large (e.g., satellite links), the channel is wasted for most of the time.
- Efficiency = 1 / (1 + 2a) where a = propagation delay / transmission time
- For large values of a, efficiency drops drastically.
2. Slow Data Transfer
- Because only one frame is in transit at any time, the overall data transfer rate is very slow compared to the available bandwidth.
3. Wastes Bandwidth
- The communication channel remains idle while the sender waits for an ACK, leading to severe underutilization of the available bandwidth.
4. Not Suitable for Long-Distance Communication
- On links with high propagation delay (e.g., satellite or intercontinental links), the round-trip time is very large, making Stop-and-Wait extremely inefficient.
5. Performance Degrades with Errors
- Every time an error occurs, the sender must wait for the timer to expire before retransmitting, adding significant delay.
6. Only One Frame Buffered
- The sender needs to keep only one frame in its buffer, but this severely limits the pipeline and throughput.
Conclusion
Stop-and-Wait ARQ is a simple and easy-to-implement error control protocol that handles frame loss, frame damage, ACK loss, and duplicate frames using timers, retransmissions, and sequence numbers. However, its one-frame-at-a-time approach makes it highly inefficient, especially over high-latency or high-bandwidth links. More advanced protocols like Go-Back-N ARQ and Selective Repeat ARQ were developed to overcome these limitations by allowing multiple frames to be in transit simultaneously (pipelining).
Overview Virtual Circuit Switching, Frame Relay& ATM
2079 ยท 5 marks
What is a virtual circuit network? Explain frame relay as a virtual circuit-wide area network. [5]
2078 ยท 5 marks
What is virtual circuit network? Explain ATM as a virtual circuit wide area network. [5]
Ethernet Standards
2078 ยท 5 marks
What is CSMA/CD? Why is there no need for CSMA/CD on a full-duplex Ethernet LAN? [5]
Wireless LAN
2076 ยท 5 marks
Why do we need wireless LAN? Explain the architecture of IEEE 802.11 in detail. [5]
Make Unit 3 stick
Practice CSC263 with flashcards & quizzes