Overview
As I briefly covered in Data Link Layer Devices , the data link layer has an Ethernet header and Ethernet trailer containing the MAC address and Frame Check Sequence (FCS), respectively.

Figure 5.11 Data link layer.
For lecture 7, it will be divided into four parts, answering the following questions.
- Framing: How to identify the beginning and end of frames?
- 7.1 Data Link Layer - Framing
- Error Detection and Handling: How to detect and correct errors because of noise
at the physical layer? How to retransmit and handle frame loss?
- 7.2 Data Link Layer - Error Detection
- 7.3 Data Link Layer - Error Correction
- Media Access Control (MAC): How to avoid conflict when many hosts use a shared medium, such as a single network cable?
- 7.4 Data Link Layer - Collisions
Framing
In computer networks, data is organized into frames or packets. When data is transmitted over a network medium (e.g. a network cable), the medium itself doesn't have a concept of frames or packets. It treats data as a continuous stream of bits.

Figure 7.1 Bit streams in the medium.
In the process of transmitting data, it's important to break the continuous stream of bits into smaller units (frames or packets). Frame synchronization helps receivers recognize the boundaries of these units.
Frame Synchronization Methods
These methods help in identifying the boundaries of individual frames, which is essential for accurate data processing.
- Time Gap Synchronization: Involves leaving a time gap between frames (e.g., a sequence of zeros).
- The gap signifies the transition between frames and is only feasible if an idle state or recognizable pattern can be identified between frames.
- Advantage: A simple and easy-to-implement method.
- Disadvantages: To ensure that the receiver can accurately recognize the time gap, it needs to be sufficiently long. This extended gap can result in a performance penalty, reducing the overall data throughput.
- Start & End Flags: Using special data sequences, via start and end flags.
- The start flag indicates the beginning of a frame, while the end flag marks its conclusion.
- Advantages: This method is effective and widely used. It's capable of providing accurate frame synchronization.
- Disadvantages: Using start and end flags increases the amount of overhead per frame transmission. Additionally, more complex methods might have an impact on data processing time.
We’ll focus primarily on the start and end flags method. Often, both start and end flags are the same character.

Figure 7.2 Start and end flag.
The issue comes from the flag selection. If flags aren't restricted to printable characters, ambiguity can occur, causing data corruption.