330 likes | 354 Views
CS412 Introduction to Computer Networking & Telecommunication. Data Link Layer Part I – Designing Issues and Elementary Protocols. Topics. Introduction Framing Error Control Flow Control Elementary Data Link Protocols. Introduction.
E N D
CS412 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary Protocols Chi-Cheng Lin, Winona State University
Topics • Introduction • Framing • Error Control • Flow Control • Elementary Data Link Protocols
Introduction • Algorithms to achieve reliable, efficient communication between two adjacent machines at the layer • Adjacent: Physically connected by a communication channel
Introduction • Issues • Services to network layer • Framing • Determining how bits are grouped into frames • Error control • Flow control
Functions of the Data Link Layer • Relationship between packets and frames.
Services to Network Layer • Transferring data between network layers of machines
Services • Unacknowledged connectionless service • Appropriate for • Low error rate, higher layers recover errors • Real-time traffic e.g., speech, video • Most LANs • Acknowledged connectionless service • Useful over unreliable channels • e.g., wireless systems
Services • Acknowledged connection-oriented service • Guarantees • Each frame sent is received without error • All frames sent are received in right order Network layer always receives correct packets in the order in which the packets were sent • Three phases: • Connection establishment • Variables and counters initialization • Frame transmission • Connection release • Variables, buffers, resources freed up
Framing • Fact • Raw bit stream delivered by physical layer is not error free • Data link layer detects/corrects errors • Framing • Computing checksum • Handling error if any
Framing • How about inserting time gaps? • Trust no time!! • Approaches • Character count • Starting/ending character w/ character stuffing • Starting/ending flags w/ bit stuffing • Physical layer coding violations
Character Count • A field in header specifies number of characters in a frame. • Problem?
Starting/Ending Characters w/ Character Stuffing • A frame delimited by flag bytes. • Four examples of byte sequences before and after stuffing.
Starting/Ending Flags w/ bit Stuffing • Flag byte (special bit pattern): 01111110 • Problem: 6 consecutive 1s in data • Solution: Bit Stuffing: Inserting a 0 after 5 consecutive 1s Original Data After Stuffing After received and destuffing
Physical Layer Coding Violations • Encoding on physical medium • Framing by invalid physical code • Use some code that does not represent 0 nor 1 • Example • Manchester encoding in 802 LAN standard (Ch. 4) • Combination of approaches is possible • E.g., character count + one other method
Error Control • Using acknowledgement • Positive • Negative • Problem: In some cases, sender waits for acknowledgement forever • Solution: Timer • Problem: Duplicate transmission • Solution: Sequence number
Positive Acknowledgement • Sender sends a message, waits for acknowledgement from receiver, and then sends next message • There’s no free lunch, though overhead, delay • How does it work?
Reliability and Acknowledgement • Case 2: data lost Sender Receiver • Case 1: no error Sender Receiver Time Data Time Data X Timeout Ack. Data Ack. Timeout and retransmission
Reliability and Acknowledgement • Case 3: data error Sender Receiver • Case 4: ack. lost Sender Receiver Time Data Time Data Error Timeout Timeout X Data Data Ack. Ack. Timeout and retransmission New problem? Duplicate Solution: Sequence number
Flow Control • Needed • Problem • When frames are transmitted faster than receiver can accept, frames will be lost • Solution • Flow control by feedback mechanism
Elementary Data Link Protocols • Key Assumptions • Network, data link, and physical layers are independent processes communicating by sending messages • Machine A wants to send a long stream of data to machine B over a reliable, connection-oriented service
Data Structures and Primitives Just think of it as a class containing data only…
Unrestricted Simplex Protocol • Utopia protocol • Assumptions • Unidirectional data transmission • Transmitting/receiving network layers are always ready • Processing time is ignored • Infinite buffer space • No errors
Simplex Stop-and-Wait Protocol • Assumptions • Unidirectional data transmission • Transmitting/receiving network layers are always ready • Finite processing speed • Finite buffer capacity • No errors • Problem: Sender sends too fast • Stop-and-wait • Senders sends one frame and then waits for an acknowledgement before processing
Simplex PAR Protocol • For noisy channel • Positive acknowledgement w/ retransmission • Sender waits for a positive acknowledgement before advancing to the next data item • A. k. a. ARQ (Automatic Repeat reQuest)
PAR Protocol • Assumptions • Unidirectional data transmission • Transmitting/receiving network layers are always ready • Finite processing speed • Finite buffer capacity • Errors, can be detected • Timer + sequence number • Size (i.e., # bits) of sequence number?