CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang.
-
Upload
cassandra-sharlene-hamilton -
Category
Documents
-
view
218 -
download
4
Transcript of CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang.
CSC 535Communication Networkls I
Chapter 5bPeer-to-Peer Protocols
Dr. Cheer-Sun Yang
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
2
n+1entity
SAP1
n+1entity
SAP2
n entity n entity
n-SDU
n-SDU
n-SDU
H
H n-SDU
n-PDU
Figure 5.1
3
Peer-to-Peer Protocols(1)Used for linking a host to another host or
point-to-point (2)used for linking an end system with another end system.
Physical layer delas with bits; data link layer deals with frames; network layer deals with datagrams or packets; transport layer deals with segments.
In this chapter, we focus on data link layer protocols: stop-and-wait (with) ARQ, Go-Back-N (with) ARQ, and Selective Repeat (with) ARQ
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
4
3 2 11 2
21
3 2 11 2
21
21
Medium
1
2
Physical layer entity
Data link layer entity3 Network layer entity
PhysicalLayer
Data linkLayer
PhysicalLayer
Data linkLayer
A B
A B
Packets Packets
Frames
(a)
(b)
Figure 5.2
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
5
PhysicalLayer
Data linkLayer
PhysicalLayer
Data linkLayer
End system
NetworkLayer
NetworkLayer
PhysicalLayer
Data linkLayer
NetworkLayer
PhysicalLayer
Data linkLayer
NetworkLayer
TransportLayer
TransportLayer
MessagesMessages
Segments
End system
Network
Figure 5.3
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
6
3 2 11 2
21
3 2 11 2
21
21
Medium
A B
3 2 11 2
21
C
21
21
2 134 1 2 3 4
End System End System
Network1
2
Physical layer entity
Data link layer entity3 Network layer entity
3 Network layer entity
Transport layer entity4
Figure 5.4
7
ARQ ProtocolsA frame level error recovery technique. Their
purpose is to ensure that frame level error can be recovered automatically without the request of upper layer (i.e., network layer) software.
ARQ forms the basis for point-to-point protocols that provide for reliable transfer of information.
There are three protocols: Stop-and-Wait ARQ Go-Back-N ARQ Selective Repeat ARQ
8
Point-to-Point RequirementsData link layer provides a point-to-point reliable
service.This service provides an adaptation function for
a host to attach to a network.Major issues include but are not limited to:
arbitrary message size (major) reliability and sequencing (=>transport layer) pacing and flow control (=>transport layer) timing (major) addressing (major) privacy, integrity, and authentication
(=>presentation)
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
9
Application Network Application
AdaptationFunction
AdaptationFunction
End-to-end application requirements
Network service
Figure 5.5
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
10
1 call = 1 message = entire sequence of speech samples
1 call = sequence of 1-byte messages
(a)
(b)
(c)
1 long message
2 or more blocks
2 or more short messages
1 block
Figure 5.6
11
End-to-End vs. Hop-by-HopData link layer provides hop-by-hop (or
point-to-point) services, whereas transport layer provides end-to-end (or host-to-host) services.
In this chapter, we will only talk about data link layer functions. (Skip 5.1.3-it causes more confusion to a beginner than clarification.)
We first take a look at a point-to-point communication model.
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
12
Packet sequence
Error-free packet
sequence
Informationframes
Control frames
Transmitter Receiver
CRC
Informationpacket
Header
Station A Station B
Information Frame
Control frame
CRC Header
Figure 5.8
13
Other Basic Elements:Information frames (I-frames): user
packets (to/ from network layer)Control frames: ACKs,NAKs, or enquiry
frame ENQTime-out mechanism
We begin with Stop-and-Wait ARQ
14
Stop and WaitSource transmits frameDestination receives frame and replies
with acknowledgementSource waits for ACK before sending next
frameDestination can stop flow by not send ACKWorks well for a few large frames(Add time out mechanism)
=>Stop-and-Wait ARQ
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
15
(a) Frame 1 lost
A
B
frame 0
frame1
ACK
frame1
ACK
timeTime-out
frame2
(b) ACK lost
A
B
frame 0
frame1
ACK
frame1
ACK
timeTime-out
frame2
ACK
In parts (a) and (b) transmitting station A acts the same way, but part (b) receiving station B accepts frame 1 twice.
Figure 5.9
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
16
A
B
frame 0 frame
0ACK
frame1
ACK
timetime-out
frame2
Transmitting station A misinterprets duplicate ACKs
Figure 5.10
Possible ambiguities when ACKs are unnumbered.
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
17
Transmitter Receiver
SlastRnext
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
(0,0) (0,1)
(1,0) (1,1)
Timer
Global State:(Slast, Rnext)
Error-free frame 0arrives at receiver
ACK forframe 0arrives attransmitter
ACK forframe 1arrives attransmitter Error-free frame 1
arrives at receiver
Station A Station BRnext
Slast
Figure 5.11
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
18
(a) Frame 1 lost
A
B
frame 0
frame1ACK
1
ENQ
ACK1
time
Time-out
frame1
(b) ACK for frame 1 lost
A
B
frame 0
frame1ACK
1
ENQACK
0
timeTime-out
frame0ACK
0
Figure 5.12
19
FragmentationLarge block of data may be split into small
frames Limited buffer size Errors detected sooner (when whole frame
received) On error, retransmission of smaller frames is
needed Prevents one station occupying medium for
long periods
Stop and wait becomes inadequate
20
Go-Back-N ARQStop-and-Wait is too conservative and the
effective information transmission rate and protocol transmission efficiency (discussed later) are too low.
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
21
A
B
fr0
timefr1
fr2
fr3
fr4
fr5
fr6
fr3
ACK1 error
Out-of-sequence frames
Go-Back-4: 4 frames are outstanding; so go back 4
fr5
fr6
fr4
fr7
fr8
fr9
ACK2
ACK3
ACK4
ACK5
ACK6
ACK7
ACK8
ACK9
Figure 5.13
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
22
A
B
fr0
timefr1
fr2
fr3
fr0
error
Out-of-sequence frames
4 frames are outstanding; so go back 4
fr2
fr3
fr1
fr4
fr5
fr6
A
B
timefr0
fr0
error
Time-out expires
fr1
ACK1
Stop-and-Wait
Go-Back-N
ACK1
ACK2
ACK3
ACK4
ACK5
ACK6
Figure 5.14
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
23
Timer Slast
Slast+1
Srecent
Slast+Ws-1
Timer
Timer
Transmitter Receiver
...
Receive Window
Buffers
Slast Slast+Ws-1
...Send Window
Srecent
Framestransmittedand ACKed
Rnext
framesreceived
The receiver will only accepta frame that is error-free and that has sequence number Rnext
...
Figure 5.15
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
24
A
B
fr0
timefr1
fr2
fr3
fr0
fr1
fr2
fr3
ACK1
M =22 = 4, Go-Back - 4:
ACK4
ACK2
ACK3
Transmitter goes back 4
Receiver has Rnext=0, but it does not know whether its ACK for frame 0 was received, so it does not know whether this is the old frame 0 or a new frame 0
A
B
fr0
timefr1
fr2
fr0
fr1
fr2
ACK1
M=22=4, Go-Back-3:
ACK2
ACK3
Transmitter goes back 3
Receiver has Rnext=3 , so it rejects the old frame 0
Figure 5.16
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
25
A
B
fr0
timefr1
fr2
fr3
fr4
fr5
fr1
fr2
ACK1
error
Out-of-sequenceframes
Go-Back-7:
fr4
fr5
fr3
fr6
fr7
fr0
NAK1
ACK3
ACK4
ACK5
ACK6
ACK7
ACK2
Transmitter goes back to frame 1
Figure 5.17
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
26
Transmitter Receiver
TransmitterReceiver
ACKs are piggybacked in headers
Station A Station B
RA next
“A” Receive Window
RB next
“B” Receive Window
SA last
SA last
SA last+1
SArecent
SA last+WA s-1Timer
SA last+WA s-1
...
...
Buffers
“A” Send Window
...
SB last
SB last
SBlast+1
SBrecent
SB last+WB s-1
SB last+WB s-1
...
...
Buffers
“B” Send Window
...
SArecent RA next
SBrecent RB next
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Figure 5.18
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
27
TfTf
Tproc
TpropTprop
Tout
Figure 5.19
28
Selective Repeat ARQData link layer provides hop-by-hop (or
point-to-point) services, whereas transport layer provides end-to-end (or host-to-host) services.
In this chapter, we will only talk about data link layer functions. (Skip 5.1.3-it causes more confusion to a beginner than clarification.)
We first take a look at a point-to-point communication model.
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
29
Transmitter Receiver
Buffers
Slast Slast+Ws-1
...Send Window
Srecent
Framestransmittedand ACKed
Timer Slast
Slast+1
Srecent
Slast+Ws-1
Timer
Timer
...
...
Receive Window
Rnext
Framesreceived Rnext +Wr-1
Rnext+1
Rnext+2
Rnext+Wr-1
...
Buffers
Figure 5.20
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
30
A
B
fr0
timefr1
fr2
fr3
fr4
fr5
fr6
fr2
ACK1 error
fr8
fr9
fr7
fr10
fr11
fr12
ACK2
NAK2
ACK7
ACK8
ACK9
ACK10
ACK11
ACK12
ACK2
ACK2
ACK2
Figure 5.21
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
31
A
B
fr0
timefr1
fr2
fr0
ACK1
M=22=4, Selective Repeat: Send Window = Receive Window = 3
ACK2
ACK3
Receive Window {3,0,1}
Frame 0 resent
A
B
fr0
timefr1
fr0
ACK1
Send Window = Receive Window = 2
ACK2
Receive Window {2,3}
Frame 0 resent
frame 0 rejected
Figure 5.22
32
Transmission EfficiencyIntuitively, stop-and-wait is the worst; go-
back-n could be better if error rate is not too high; selective repeat could be better is error is high.
Now, we will discuss them formally.
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
33
frametf time
A
B
tproptack tproc
tprop
tproc
t0
Figure 5.23
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
34
0
0.2
0.4
0.6
0.8
11.
E-0
1
5.E
-02
1.E
-02
5.E
-03
1.E
-03
5.E
-04
1.E
-04
5.E
-05
1.E
-05
5.E
-06
1.E
-06
5.E
-07
1.E
-07
Selective RepeatGo-Back-N
Stop & Wait
p
Figure 5.24
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
35
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
32 64 128 256 512 1024 1536 2048nf
Selective Repeat
Go-Back-N
Stop &Wait
62 32 1710
63
33
Figure 5.25
36
Flow ControlFlow control refers to procedures that
prevent a transmitter from overrunning a receiver’s buffer.
Congestion control refers to a network layer function that prevents a source to overwhelm a router’s buffer.
Techniques: (physical layer) X-ON/X-OFF(“server” to “client”) (physical layer) RTS/CTS (host to/from modem,
respectively) (data link layer) sliding window protocols
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
37
on off offon
A
B
transmit transmit
2Tprop
time
time
Figure 5.26
38
Sliding Windows Flow ControlAllow multiple frames to be in transitReceiver has buffer W longTransmitter can send up to W frames
without ACKEach frame is numberedACK includes number of next frame
expectedSequence number bounded by size of field
(k) Frames are numbered modulo 2k
39
Sliding Window Diagram
40
Sliding Window EnhancementsReceiver can acknowledge frames without
permitting further transmission (Receive Not Ready)
Must send a normal acknowledge to resume
If duplex, use piggybacking If no data to send, use acknowledgement
frame If data but no acknowledgement to send, send
last acknowledgement number again, or have ACK valid flag (TCP)
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
41
A
B
tcycle
return of permits
time
time
Figure 5.27
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
42
Network
Synchronous source sends periodic information blocks
Network output not periodic
Figure 5.28
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
43
sendtimes
playouttimes
arrivaltimes
Tplayout time
time
Receiver too slowbuffer overflow
Tplayout time
timeReceiver too fastbuffer starvation
Many latepackets
Tplayout time
timeReceiver speedjust right
Figure 5.29
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
44
t4 t3 t2 t1
Timestamps
Add Smoothingfilter
Adjustfrequency Recovered
clock
Counter
+
-
Buffer for information blocks
Errorsignal
Playoutcommand
Figure 5.30
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
45
Network clock
fn
Transmitter
Network
Receiver
fs fr
f f
Figure 5.31
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
46
byte stream
Send buffer
Segments
Receive buffer
byte stream
Application Application
ACKs
Transmitter Receiver
Figure 5.32
* SKIP SECTION 5.3.3 !!!
47
Summary of Major Data Link Layer Functions:Framing: where to begin and where to endError control: error detection and frame
level error recoveryFlow control: error control is not enough!
48
Example Data Link Layer Protocols (HDLC, PPP)High Level Data Link Control (HDLC)Point-to-Point Protocol (PPP)
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
49
PhysicalLayer
Data LinkLayer
Data LinkLayer
NetworkLayer
DLSDU DLSDU
NetworkLayer
PhysicalLayer
DLPDU
NLPDU
“packet”
“frame”
DLSAP DLSAP
Figure 5.32
50
HDLC Station TypesPrimary station
Controls operation of link Frames issued are called commands Maintains separate logical link to each
secondary station
Secondary station Under control of primary station Frames issued called responses
Combined station May issue commands and responses
51
HDLC Link ConfigurationsUnbalanced
One primary and one or more secondary stations
Supports full duplex and half duplex
Balanced Two combined stations Supports full duplex and half duplex
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
52
Primary SecondaryCommands
Responses
Unbalanced Point-to-point link
PrimaryCommands
Responses
Secondary Secondary Secondary
Unbalanced Multipoint link
Primary
Secondary
Commands Responses
Balanced Point-to-point link between Combined Stations
Primary
Secondary
CommandsResponses
Figure 5.33
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
53
Flag FlagAddress Control Information FCS
Figure 5.35
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
54
0 N(S) N(R)P/F
1 2-4 5 6-8
Information Frame
N(R)P/F
Supervisory Frame
Unnumbered Frame
1 0 S S
P/F1 1 M M M M M
Figure 5.36
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
55
SABM UAUA DISCDatatransfer
Figure 5.37
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
56
Primary A Secondaries B, C
B, RR, 0, P
B, I, 0, 0B, I, 1, 0B, I, 2, 0,F
X
B, SREJ, 1
C, RR, 0, P
C, RR, 0, F
B, SREJ, 1,P
B, I, 1, 0B, I, 3, 0B, I, 4, 0, F
B, I, 0, 5
Figure 5.38
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
57
Combined Station A Combined Station B
B, I, 0, 0 A, I, 0, 0
B, I, 1, 0
B, I, 2, 1
A, I, 1, 1
A, I, 2, 1
X
B, REJ, 1B, I, 3, 2
B, I, 4, 3
B, I, 1, 3
B, I, 2, 4
B, I, 3, 4
A, I, 3, 1
B, RR, 2
B, RR, 3
Figure 5.39
58
Other DLC Protocols (LAPB,LAPD)Link Access Procedure, Balanced (LAPB)
Part of X.25 (ITU-T) Subset of HDLC - ABM Point to point link between system and packet
switching network node
Link Access Procedure, D-Channel ISDN (ITU-D) ABM Always 7-bit sequence numbers (no 3-bit) 16 bit address field contains two sub-addresses
One for device and one for user (next layer up)
59
Other DLC Protocols (PPP)Provides a method for encapsulating
datagrams over point-to-point linkscan be used to connect two routerscan be used to connect a PC to the
Internet via a modem over a phone line
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
60
Flag flagAddress Control Information CRCProtocol01111110 011111101111111 00000011
Unnumbered frame
Specifies what kind of packet is contained in the payload, e.g., LCP, NCP, IP, OSI CLNP, IPX
All stations are toaccept the frame
Figure 5.40
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
61
A Typical Scenario
Home PC to Internet Service Provider
1. PC calls router via modem.2. PC and router exchange LCP
packets to negotiate PPP parameters.
3. Check on identities.4. NCP packets exchanged to
configure the network layer, e.g., TCP/IP ( requires IP address assignment).
5. Data transport, e.g. send/receive IP packets.
6. NCP used to tear down the network layer connection (free up IP address); LCP used to shut down data link layer connection.
7. Modem hangs up.
Dead
Establish
Authenticate
Network
Terminate
Open
failed
failed
1. CarrierDetected
2. OptionsNegotiated
3. AuthenticationCompleted4. NCP
Configuration
6. Done
7. CarrierDropped
5.
Figure 5.41
62
Required ReadingChapter 5