The datalink layer Flashcards
Role of the datalink layer
The Data Link Layer is responsible for:
- Framing
- Error handling
- Flow control
What is a frame
Its is the transmitted element in Data Link layer . A frame is regarded either as a block of bytes, or as a sequence of bits
Framing (to frame)
- The sender assembles/breaks an incoming sequence of packets (from network layer) into frames
- The receiver does the opposite
Framing extraction
The receiver must determine the first and last bit/byte of the frame so that the frames can then be extracted
Byte count
- Payload is transmitted as a variable length block of bytes preceded by a byte count
- this method uses a field in the header to specify the number of bytes in the frame
Data transparency problem
It may happen that the flag byte occurs in the data .
This would cause the protocol software to incorrectly assume that the frame was finished at that point
Solution to data transparency problem
insert a special escape byte (ESC) just before each ‘‘accidental’’ flag byte in the data. This is known as Byte stuffing
Redundant data
In the data link layer, redundant data refers to extra bits added to the data being transmitted to detect and correct errors. This helps to improve the reliability of the communication.
Error detection techniques
- Parity bit
- Checksums
- Cyclic Redundancy Check (CRC)
Flow control protocol
It controls the sending of transmission frames at a faster pace than they can be accepted e.g. Simple Stop and Wait Protocol
Stop and Wait protocol
- Sender sends one data frame
- Receiver receives the data frame and send an acknowledgment
- Sender receives the Acknowledgment and sends the next data frame
Disadvantages of stop and wait protocol
- Slow
- Cannot be used in noisy channel
Problems with stop and wait protocol
- Damaged frame
- Lost data frame
3.Lost ACK
Timeout problem with Stop and wait protocol
- If it is too long, (A) will wait unnecessarily long before
retransmission, causing the link to be idle - if it is too short, the protocol may fail due to the
occurrence of duplicate ACKs.
Automatic Repeat ReQuest Protocols
- A group of error control protocols incorporated with stop and wait flow control protocol for transmission of data over a noisy or unreliable network
- They provide automatic retransmission of frames that are corrupted or lost during transmission
3 types of Automatic Repeat Request Protocols
- Stop – and – Wait ARQ
- Go – Back – N ARQ
- Selective Repeat ARQ
Stop and wait ARQ
- “A” sends a frame with a unique sequence number, then waits for “B” to acknowledge it (flow control)
- If a timeout occurs ,the frame is retransmitted again (error control)
- frames with CRC errors are rejected by “B” and a NAK is sent
- Duplicate frames or Acks are also rejected
piggy backing
- Data frames sent by a receiver carry acknowledgements of its received frames.
- Similar to Sop and Wait ARQ
Advantages of piggy backing
- Better channel utilisation: fewer bits
transmitted - Less computation by the hosts: less work to
pack, unpack and check the extra frames
disadvantages of piggy backing
- If the receiver waits “too long” to send a
piggybacked acknowledgement (waiting for
a data frame to be available), the sender
will time-out and retransmit the frame!
Go back N protocol
- It allows for sending N frames before receiving the acknowledgement for the first frame
- The frames are sequentially numbered
- It uses the concept of sliding windows at the sender and the receiver, and so is also called Go
-Back-N sliding window protocol
Selective Repeat ARQ Protocol
- This protocol also provides for sending N frames before receiving the acknowledgement
for the first frame - The frames are sequentially numbered
- It uses the concept of sliding windows at the sender and the receiver, and so is also called
Selective Repeat sliding window protocol
What if the frame is a block of bytes
- Byte count
- Start and end flag bytes with byte stuffing
What if the frame is a sequence of bits
- Start and end flag bytes with bit stuffing
Byte stuffing
It is a method of inserting special escape characters into a data stream to signal the start and end of a frame. It is used to ensure that certain sequences of bytes, known as flag sequences, do not occur within the data.
Bit Stuffing
Bit stuffing is a method of inserting extra bits into a data stream to ensure that certain bit patterns do not occur within the data. It is used to maintain the integrity of a frame structure in communication protocols.
Error Handling
Detecting and correcting errors from the physical layer
how to solve stop and wait timeout problem
- This can be solved by including the sequence number of
the acknowledged frame into the ACK frame itself. - However, all frames are still sent twice, causing 50% loss of
transmission capacity