Download presentation
Presentation is loading. Please wait.
1
Ch 16 Protocols and Layering
Spring 2003
2
Motivation Explains why hardware along does not solve all communication problems, and shows why protocol software is also need Describes the concept of layering
3
The Need for Protocols Communication hardware can transfer bits from point to another Many problems can occur Bits corrupted or destroyed Entire packet lost Packet duplicated Packets delivered out of order
4
The Need for Protocols Software handles low-level communication details and problems Protocol is a set of rules to be used when exchanging messages Most AP do not interact with net HW directly AP HW Protocol
5
Protocol Specifies Format of messages Meaning of messages
Rules for exchange Procedure for handling problems
6
Protocol Suites Each protocol solves part of communication problem
Work well together; known as protocol suite /w/ Make each protocol easier to design, analyze, implement, and test AP AP P1 Protocol … HW HW
7
A Plan for Protocol Design
Layering model Vertically divides protocols into layers Each layer devoted to one subproblem To help protocol designers understand subparts of the communication problem E.g.: ISO 7-layer reference model
8
The Seven Layers LAN
9
The Seven Layers Layer 1: Physical Layer 2: Data Link Layer 3: Network
Gives the detailed spec. of underlying hardware Layer 2: Data Link Specify hardware frame format, medium access, and checksum computation Layer 3: Network Specify address assignment and packet forwarding Layer 4: Transport Specify how to handle details of reliable transfer
10
The Seven Layers Layer 5: Session Layer 6: Presentation
Specifications for session establishment and security details Layer 6: Presentation Data representation and the translation Layer 7: Application Define how application programs, running on different end systems, pass messages to each other
11
Stacks: Layered Software
Protocol software follows layering model One software module per layer Modules cooperate Incoming or outgoing data passes from one module to another Entire set of modules known as stack
12
Data Encapsulation
13
Data Encapsulation L7 L4 Segment L3 Datagram L2 Frame FTP HTTP Telnet
Port 21 80 25 L4 TCP UDP TCP header Segment ICMP IGMP L3 IP IP header Datagram ARP RARP L2 MAC discard Ethernet header Frame Ethernet header IP TCP
14
Data Encapsulation Each layer
Places additional information in a header before sending data to a lower layer Uses, and then removes, the header to process incoming packets (e.g., L2 checksum)
15
Data Encapsulation Port number
An AP can be uniquely identified by (IP address, port number) pair Assigned ranges Numbers below 255 are for public applications Numbers from 255 to 1023 are assigned to companies for marketable applications Numbers above 1023 are unregulated Bind: creates mapping between an AP and a port number
16
Nested Packet Headers
17
Scientific Basis for Layering
Software implementing layer N at the destination receives exactly the message sent by software implementing layer N at the source
18
Layering Principle: peer-to-peer
19
Techniques Protocols Use
For bit corruption Parity bit Frame checksum CRC For out-of-order delivery Sequence numbers For lost packets Positive acknowledgement (ACK) and retransmission for time-out Max. number of try 4 3 2 1 Ack1
20
Techniques Protocols Use
Duplication Sequence numbers For replay (excessive delay) A termination request arrives from an previous conversation may terminate a current conversation Unique session ID For data overrun Flow control Bye
21
Flow Control Needed because Related to buffering Two forms
Sending computer system faster than receiving computer Sending application faster than receiving application Related to buffering Two forms Stop-and-go Sliding window
22
Stop-And-Go Sending Side Receiving side Inefficient
Transmits one packet Waits for signal from receiver Receiving side Receives and consumes packets Transmits signal to sender Inefficient
23
Sliding Window Flow Control
1 car v.s. 4 cars
24
Sliding Window Flow Control
25
Sliding Window Flow Control
Receiving side Establishes multiple buffers and informs sender Sending side Transmits packets for all available buffers Only waits if no signal arrives before transmission Sends signals as packets arrive Window tells how many packets can be sent Window moves as acknowledgements arrive
26
Comparison of Flow Control
Stop-and-go Slow Useful only in special cases Sliding window Fast Needed in high-speed network
27
Why Sliding Window? Simultaneously Speedup Tw = min(B, TG W) where
Increase throughput Control flow Speedup Tw = min(B, TG W) where TW is sliding window throughput B is underlying hardware bandwidth TG is stop-and-go throughput W is the window size
28
Congestion Fundamental problem in networks
Caused by traffic, not hardware failure Analogous to congestion on a highway Principal cause of delay
29
Illustration of Architecture That Can Experience Congestion
Multiple sources Bottleneck
30
Congestion and Loss Modern network hardware works well; most packet loss results from congestion, not from hardware failure Rate control (e.g. temporarily reducing WS)
31
The Art of Protocol Design
Protocol Design is “nontrivial” Lots of Tradeoff Size of “Sequence number” field Balance between sliding window and congestion control
32
Exercise 16.4
33
Two Common Implementations of Sliding Window Protocol
Go-Back-N Protocol Selective Repeat Protocol Source Address Destination Frame Number (K bits) ACK Type of Frame ..Data... CRC 02K-1 Frame number of a frame being acknowledged (piggybacking) Data/ACK/NACK
34
Go-Back-N receiver does not acknowledge each received frame explicitly
Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) 0,1,2,3(-) ACK 3 (4,5,6,7) 4(5,6,7) ACK 5 1 2 3 4 5 4,5(6,7) (6,7,0,1) (0) (1) (2) (3) (4) (5) (6) Sequence number: 0-7 Window size=4 Sender buffers all frames in the windows frames are removed when ACKed
35
Go-Back-N (continued)
receiver always expects to receive frames in order (2,3,4,5) Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) 0,1,2,3(-) ACK 1 2,3(4,5) 2,3,4(5) 1 2 3 (0) (1) (2) X discard 4 5 2,3,4,5(-) NAK 2 2(3,4,5) Sequence number: 0-7 Window size=4
36
Go-Back-N (continued)
frame damaged Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) 0,1,2,3(-) ACK 1 2,3(4,5) 2,3,4(5) 1 2 3 3(4,5,6) (0) (1) (2) discard 4 5 3,4(5,6) 3,4,5(6) NAK 3 (3,4,5,6) Sequence number: 0-7 Window size=4
37
Go-Back-N (continued)
Frame timer Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) ACK 1 1 2 (0) (1) (2) X Time out 3 4 5 (2,3,4,5) 2(3,4,5) 2,3(4,5) 2,3,4(5) 2,3,4,5(-) Sequence number: 0-7 Window size=4
38
Go-Back-N (continued)
Out of order + time out Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) ACK 1 1 2 (0) (1) (2) X 3 discard Time out 4 (2,3,4,5) 2(3,4,5) 2,3(4,5) 2,3,4(5) NAK 2 Sequence number: 0-7 Window size=4
39
Go-Back-N (continued)
ACK timer a frame arriving should be ACKed within a period of time use piggyback approach to ACK whenever possible send a separate ACK frame in lieu of the piggyback ACK
40
Go-Back-N (continued)
Window size should be 2K-1 Station A Station B Send frames 0 through 7. t1 Receive frames 0 through 7 in order and send an acknowledgment for frames 7 t2 Window size=2K The piggyback acknowledgment gets delayed somewhere Assume the frames were lost and resend frames 0 through 7. Receive frames 0 through 7 Since the receiver was expecting these number,it accept them as new frames,not recognizing them as duplicate t3 t4
41
Go-Back-N (continued)
Window size should be 2K-1 Station A Station B Send frames 0 through 6. t1 Receive frames 0 through 6 in order and send an acknowledgment for frames 6 t2 Window size=2K-1 The piggyback acknowledgment gets delayed somewhere Assume the frames were lost and resend frames 0 through 6. Receive frames 0 through 6 Since the receiver was expecting frame 7 it ignores them t3 t4
42
Selective Repeat Similarities to go-back-n Frame format sending window
use piggyback ACK whenever possible not acknowledge every frame explicitly use NAKs for damaged frames and out-of-order frames Frame timer ACK timer
43
Selective Repeat (continued)
Differences to go-back-n Buffer arriving frames in receiving window until all predecessors received Only the timed-out frame is resent when a frame timer expires When a NAK is received, resend just the frame specified by the NAK A piggyback ACK doesn’t necessary acknowledge the frame just received Receive sequential frames Sending Window size=3 Send frames Receiving Window size=3 7 7 6 1 6 1 5 2 5 2 4 3 4 3 Receive ACKs Receive sequential frames
44
Selective Repeat (continued)
Frame lost Sender Receiver (0,1,2,3) 0(1,2,3) 0,1(2,3) 0,1,2(3) 0,1,2,3(-) ACK 1 2,3(4,5) 2,3,4(5) NAK 2 1 2 3 4 5 2,3,4,5(-) (1,2,3,4) (2,3,4,5) X 3 (buffered) 4 (buffered) 5 (buffered) (6,7,0,1) ACK 5 Sending Window size=4 Receiving Window size=4
45
Selective Repeat (continued)
CRC error (0,1,2,3) (0,1,2,3) Sending Window size=4 0(1,2,3) Receiving Window size=4 1 0,1(2,3) 2 (1,2,3,4) 1 0,1,2(3) (2,3,4,5) 3 2 (CRC error) 0,1,2,3(-) ACK 1 3 (buffered) 4 NAK 2 2,3(4,5) 2,3,4(5) 2 4 (buffered) 2,3,4(5) 5 2 2,3,4,5(-) (5,6,7,0) 5 (6,7,0,1) Sender Receiver
46
Selective Repeat (continued)
Receiving window size should be 2K-1 Station A Station B Receiving window size>2K-1 Send frames 0 through3 t1 Receive frames 0 through 3;advance window to include frames 4,5,6,7,and 0. t2 The acknowledgement gets lost. Assume the frames were lost and resend frames 0 through 3 t3 Receive frames 0 and assume incorrectly it is a new frame. t4 time time
47
Selective Repeat (continued)
Receiving window size should be 2K-1 Station A Station B Receiving window size>2K-1 Receive frames 0 through 3 and advance window to include frames 4-7. Receive frame 4 and send an acknowledgment to A. Advance window again to include frames 5,6,7, and 0. Send frames 0 through 4 t1 t2 The acknowledgement gets lost. Assume the frames were lost and resend frames 0 through 4 t3 Receive frames 0 and assume incorrectly it is a new frame. t4 time time
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.