Download presentation
Presentation is loading. Please wait.
1
CMPE 150 – Winter 2009 Lecture 6 January 22, 2009 P.E. Mantey
2
CMPE 150 -- Introduction to Computer Networks Instructor: Patrick Mantey mantey@soe.ucsc.edu http://www.soe.ucsc.edu/~mantey/ mantey@soe.ucsc.edu Office: Engr. 2 Room 595J Office hours: Tuesday 3-5 PM TA: Anselm Kia akia@soe.ucsc.edu Web site: http://www.soe.ucsc.edu/classes/cmpe150/Winter09/ Text: Tannenbaum: Computer Networks (4 th edition – available in bookstore, etc. )
3
Syllabus
4
Assignment #3 Available on the web site: http://www.soe.ucsc.edu/classes/cmpe150/Winter09/ Due Thursday, January 29, 2009
5
Today’s Agenda Link Layer Services Framing kind, seq, ack, info Error Control (CRC) Flow Control Protocols Standards
6
Data Link Layer Design Issues Provide Services to Network Layer 1. Framing 2. Error Control 3. Flow Control
7
Cyclic Redundancy Check
8
Cyclic Redundancy Check
9
At Transmitter, with M = 1 1 1 0 1 1, compute 2 r M= 1 1 1 0 1 1 0 0 0 with G = 1 1 0 1 T = 2 r M + R [note G starts and ends with “1” ] R = 1 1 1 Transmit T= 1 1 1 0 1 1 1 1 1
10
Cyclic Redundancy Check At the Receiver, compute: Note remainder = 0 no errors detected
11
Polynomial Code M = 1 1 1 0 1 1 x 5 + x 4 + x 3 + x + 1 = M(x) G = 1 1 0 1 x 3 + x 3 + 1 = G(x) R(x) = remainder of [2 3 M(x)/G(x)] (recall r = 3) T(x) = 2 3 M(x) + R(x)
12
Error-Detecting Codes Calculation of the polynomial code checksum. Ref: Tannenbaum, Fig. 3-8
13
CRC Codes CRC-12 G(x) = x 12 + x 11 + x 3 + x 2 + x + 1 CRC-15 G(x) = x 16 + x 15 + x 2 + 1 CRC-CCITT G(x) = x 16 + x 12 + x 5 + 1 CRC-32 G(x) = x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1
14
CRC Performance Errors go through undetected only if divisible by G(x) With “suitably chosen” G(x) CRC code detects: All single-bit errors All double-bit errors, as long as G(x) has at least three “1s” Any odd number of error, as long as G(x) has a factor (x+1) Any burst error for which the length of the burst is less than the length of the G(x) (i.e. “r”) Most larger burst errors For equally-probable errors, with burst of length r+1, probability of an undetected error is 1/2 r-1 For longer burst, probability of undetected error is 1/2 r [adapted from Stallings, Chapter 7, page 205]
15
Logic implementation of Polynomial Encoder / Decoder Ref: Stallings, Fig. 7.6
17
Data Link Connects to (adjacent) computers (connected by a wire or equivalent) Serial -- Bits delivered in order sent
18
Data Link Layer - Functions Provide service interface to the network layer Dealing with transmission errors Regulating data flow Slow receivers not swamped by fast senders
19
Data Link Layer - Functions Relationship between packets and frames.
20
Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.
21
Link Layer Services Unacknowledged Connectionless Service Acknowledged Connectionless Service Acknowledged Connection-oriented Service
22
Link Layer Services Unacknowledged Connectionless Service Sender just sends, no acknowledgments No attempt to resend lost frames Acknowledged Connectionless Service Acknowledged Connection-oriented Service
23
Link Layer Services Unacknowledged Connectionless Service Sender just sends, no acknowledgments No attempt to resend lost frames Used for Real-time traffic (voice, video) Highly reliable LANS When error control is done at higher layers (e.g. TCP) Acknowledged Connectionless Service Acknowledged Connection-oriented Service
24
Link Layer Services Unacknowledged Connectionless Service Sender just sends, no acknowledgments Acknowledged Connectionless Service No logical connection Frames individually acknowledged Tannenbaum says “an option, not a requirement” BUT: Acknowledged Connection-oriented Service
25
Link Layer Services Unacknowledged Connectionless Service Sender just sends, no acknowledgments Acknowledged Connectionless Service No logical connection Frames individually acknowledged Tannenbaum says “an option, not a requirement” BUT: large packets become multiple (fixed size) frames Some frames get through, others lost, then resend of packet is very inefficient vs. resend of lost frames Acknowledged Connection-oriented Service
26
Link Layer Services Unacknowledged Connectionless Service Acknowledged Connectionless Service Acknowledged Connection-oriented Service Connection established before data sent Each frame numbered Data link guarantees error-free delivery Each frame received once and only once (vs. connectionless, where a packet can be received several time – if errors or timeouts occur Provides reliable bit stream to Network Layer
27
Connection-Oriented Service Protocol steps 1. establish connection 2. reliably deliver data stream Number frames Acknowledgments 3. free the connection
28
Link Layer Connection of Routers in WAN Using Connection- Oriented Service Ref: Tannenbaum, Fig. 3-3
29
Framing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. Ref: Tannenbaum, Fig. 3-5
30
Framing: Bit Stuffing Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing. Ref: Tannenbaum, Fig. 3-6
31
Elementary Data Link Protocols Manage data flow at Link Layer An Unrestricted Simplex Protocol A Simplex Stop-and-Wait Protocol A Simplex Protocol for a Noisy Channel
32
Protocol Definitions Continued Some definitions needed in the protocols to follow. These are located in the file protocol.h.
33
Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.
34
Unrestricted Simplex Protocol
35
From Stallings: Data and Computer Communications
36
Stop-and-Wait Simplest form of flow control. –Transmitter sends frame and waits. –Receiver receives frame and sends ACK. –Transmitter gets ACK, sends other frame, and waits, until no more frames to send. Good when few frames. Problem: inefficient link utilization. –In the case of high data rates or long propagation delays.
37
Simplex Stop-and- Wait Protocol
38
Animations http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/go- back-n/go-back-n.html http://www.humboldt.edu/%7Eaeb3/telecom/SlidingWindow.htmlhttp://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/go- back-n/go-back-n.html http://www.humboldt.edu/%7Eaeb3/telecom/SlidingWindow.html http://netbook.cs.purdue.edu/othrpags/page15.htm
39
From Stallings: Data and Computer Communications
40
A Simplex Protocol for a Noisy Channel A positive acknowledgement with retransmission protocol. Continued
41
A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol.
42
Sliding Window Protocols
43
Supports bi-directional data transfer Full-duplex “piggy backing” of acks
44
Sliding Window Protocols A One-Bit Sliding Window Protocol A Protocol Using Go Back N A Protocol Using Selective Repeat
45
Sliding Window Protocols (2) A sliding window of size 1, with a 3-bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received. Tannenbaum Figure 3-13
46
Sliding Window Allows multiple frames to be in transit at the same time. Receiver allocates buffer space for n frames. Transmitter is allowed to send n (window size) frames without receiving ACK. Frame sequence number: labels frames.
47
Sliding Window Receiver ack’s frame by including sequence number of next expected frame. Cumulative ACK: ack’s multiple frames. Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack’s receipt of 2, 3, and 4.
48
Sliding Window Sender maintains sequence numbers it’s allowed to send; receiver maintains sequence number it can receive. These lists are sender and receiver windows. Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 … 2 k -1, modulo 2 k. Transmission window shrinks each time frame is sent, and grows each time an ACK is received.
49
Example: 3-bit sequence number and window size 7 A (sender) (receiver) B 0 1 2 3 4 5 6 7 0 1 2 3 4... 0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 0 1 2 3 4 5 6 7 0 1 2 3 4 RR3 0 1 2 3 4 5 6 7 0 1 2 3 4 3 4 5 6 RR4 0 1 2 3 4 5 6 7 0 1 2 3 4 Stallings Figure 7-4
50
A One-Bit Sliding Window Protocol Continued
51
A One-Bit Sliding Window Protocol (ctd.)
52
1-bit Sequence Number Distinguish between “original” transmission and “retransmission” Sequence number will do this Extra long sequence field wasteful of header / channel Minimum size = 1 bit ! Need to distinguish between frame m and frame m+1 Sender keeps trying to send frame m until it is acknowledged Sender won’t send m+1 until m is acknowledged (Sender won’t send m+2 until m+1 is acknowledged – which means m was correctly received and acknowledged ) Receiver knows what sequence number to expect next Arriving frame with wrong sequence number is rejected as a duplicate Correctly received frame – with right sequence number – sent to network layer and expected sequence number incremented by 1 modulo 2.
53
One-Bit Sliding Window Protocol Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet. Tannenbaum Figure 3-15
54
Bit Length of a Link Assume link is fully occupied 1 st bit is just arriving at the receiver sender has sent continuously R = data rate (bps) d = distance (length of link) (meters) V = propagation velocity (meters / second) (~ 2 - 3 x 10 8 meters/second) Bit length = Rd / V bits
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.