PeertoPeer Protocols - PowerPoint PPT Presentation

1 / 59
About This Presentation
Title:

PeertoPeer Protocols

Description:

Station A sends Frame 2 and waits for ACK or timeout (a) Frame 1 lost. A. B. frame. 0 ... Sender must wait for one round trip on the link before a second ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 60
Provided by: warrenmo
Category:

less

Transcript and Presenter's Notes

Title: PeertoPeer Protocols


1
Peer-to-Peer Protocols
  • Service Models
  • Connectionless, Connection oriented, adaptation
  • ARQ Protocols
  • types, performance
  • Other Adaptation Techniques
  • Flow control, timing recovery
  • Data Link Control
  • Multiplexers

2
Data Link Layer
Packets
Packets
(a)
Data link Layer
Data link Layer
Frames
A
B
Physical Layer
Physical Layer
  • Packets input/output to the network layer
  • Frames transferred between endpoints
  • Physical layer handles the electrical/optical
    communication

Figure 5.2
3
Spatial view
(b)
A
B
1
Physical layer entity
Network layer entity
3
2
Data link layer entity
  • Each node has a single network layer entity
  • Each link has data link and physical entities

Figure 5.2
4
Peer-to-Peer across a network
Messages
Messages
Segments
Transport Layer
Transport Layer
Network Layer
Network Layer
Network Layer
Network Layer
Data link Layer
Data link Layer
Data link Layer
Data link Layer
End system a
End system B
Physical Layer
Physical Layer
Physical Layer
Physical Layer
Network
Figure 5.3
5
C
3
End System a
End System b
4
4
3
3
Medium
A
B
Network
1
Physical layer entity
Network layer entity
Network layer entity
2
Data link layer entity
Transport layer entity
Figure 5.4
6
Service Models
  • Define how information is exchanged at a layer
  • Service model attributes
  • Connectionless vs Connection oriented
  • Reliable vs best effort
  • Quality of service (performance guarantee)
  • May require adaptation from what is provided at a
    lower layer
  • Change message sizes
  • Reliability and sequencing
  • Pacing and flow control
  • Timing
  • Addressing
  • Privacy, integrity, and authentication

7
Adaptation function for a network
Application
  • Adaptation function uses network service and
    internal logic to meet end-to-end requirements

Figure 5.5
8
Segmentation and Blocking
1 long message
2 or more short messages
(c)
2 or more blocks
1 block
  • Adaptations for services with mismatched message
    sizes
  • Blocks contain sequencing and segmentation
    information to reconstruct the original messages

Figure 5.6
9
Error control Alternatives
End-to-end
  • One check at the receiver
  • Efficient, but not for high error rates
  • Example TCP
  • One check at each link
  • More work but better performance at high error
    rates
  • Example HDLC

Figure 5.7
10
Error Recovery using ARQ
Error-free packet sequence
Information frames
Packet sequence
Transmitter
Receiver
Station B
Station A
Control frames
ACK NAK ENQ
CRC
CRC
Header
Control frame
Information packet
Information Frame
Figure 5.8
11
Stop and Wait ARQ
A
B
Station B Receives frame 1 and checks the CRC
Station A Receives ACK
12
ARQ with lost frames
(a) Frame 1 lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK
ACK
B
(b) ACK lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK
ACK
ACK
B
  • In cases (a) and (b) transmitting station A acts
    the same way, but in case (b) receiving station B
    accepts frame 1 twice.
  • Sequence information is needed to prevent
    duplicate data from getting into the completed
    stream

Figure 5.9
13
Another ambiguous sequence
time-out
time
A
frame 0
frame 0
frame 2
frame 1
ACK
ACK
B
  • Transmitting station A misinterprets the ACK from
    the lost frame 0 as acknowledging the
    retransmission
  • Receiver B will receive frames 0 0 2
  • Sequence numbers are needed to resolve ambiguities

Figure 5.10
14
A state model with sequencing
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
Rnext
Slast
Timer
Slast
Receiver
Transmitter
Rnext
Station B
Station A
Error-free frame 0 arrives at receiver
(0,0)
(0,1)
ACK for frame 0 arrives at transmitter
Global State (Slast, Rnext)
ACK for frame 1 arrives at transmitter
Error-free frame 1 arrives at receiver
(1,0)
(1,1)
Figure 5.11
15
ARQ with lost frames Revisited
(a) Frame 1 lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK0
ACK1
B
(b) ACK lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK1
ACK1
ACK0
B
time-out
(c) early timeout
time
A
frame 0
frame 0
frame 1
frame 1
ACK0
ACK0
B
Figure 5.9
16
Using ENQ to speed recovery
Time-out
(a) Frame 1 lost
time
A
frame 0
frame 1
ENQ
frame 1
ACK 1
ACK 1
B
(b) ACK for frame 1 lost
Time-out
time
A
frame 0
frame 1
frame 0
ENQ
ACK 0
ACK 0
ACK 1
B
  • ENQ allows A to figure out what frame to send
    when a timeout occurs

Figure 5.12
17
Performance with delay
  • Sender must wait for one round trip on the link
    before a second message is sent.
  • Limits the performance of the link
  • If a 1.5Mb/s link has 40ms round trip delay
  • How many bits could be sent before the ACK is
    received?
  • If the maximum frame size is 10K bits, what real
    rate to I get?

18
Go-Back N ARQ
4 frames are outstanding so go back 4
Go-Back-4
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 3
fr 5
fr 4
fr 6
fr 6
fr 7
fr 8
fr 9
A
B
Out-of-sequence frames
ACK1
ACK2
ACK4
ACK5
ACK3
ACK7
ACK6
ACK9
ACK8
error
  • Sender is allowed to send N frames before waiting
  • Receiver discards any frames with wrong sequence
    numbers
  • Sender goes back N frames on Timeout
  • Modifications when there arent N frames to send

Figure 5.13
19
Comparison
20
Sliding windows (Go back N ARQ)
Transmitter
Receiver
Send Window
Receive Window
...
Frames transmitted and ACKed
Slast
Srecent
SlastWs-1
frames received
Buffers
Rnext
Slast
Timer
Slast1
The receiver will only accept a frame that is
error-free and that has sequence number Rnext
Timer
...
Srecent
Timer
...
SlastWs-1
Receive window slides forward on receiving
correct frame
Send window slides forward on receiving an
acknowledgement
Figure 5.15
21
Sliding window protocols
  • Sender sends Ws frames ahead of the last
    acknowledged packet (Slast)
  • Receiver Acknowledges all previous frames in each
    acknowledgement
  • Earlier frames are implicitly acknowledged
  • Sequence numbers are in fact limited to m bits
  • Numbers will be modulo 2m (,5,6,7,0, )
  • For the receiver to determine the correct frame,
    it must not be possible for two frames in the
    window to have the same sequence number modulo
    2m.
  • Wslt 2m

22
Transmitter goes back 4
M 22 4, Go-Back - 4
time
fr 0
fr 2
fr 1
fr 1
fr 3
fr 3
fr 2
fr 0
A
B
ACK2
ACK3
ACK4
ACK1
Receiver has Rnext0, 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
M224, Go-Back-3
Transmitter goes back 3
time
fr 0
fr 2
fr 1
fr 2
fr 0
fr 1
A
B
ACK2
ACK3
ACK1
Receiver has Rnext3 , so it rejects the old
frame 0
Figure 5.16
23
Improving Performance with NAKs
Transmitter goes back to frame 1
Go-Back-7
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 1
fr 2
fr 4
fr 3
fr 5
fr 6
fr 7
fr 0
A
B
ACK2
ACK1
ACK3
ACK4
ACK6
Out-of-sequence frames
ACK5
ACK7
NAK1
error
  • NAK tells sender to resend everything after the
    indicated frame
  • Saves waiting for senders timer to expire.

Figure 5.17
24
Bi-directional ARQ
25
Setting timeout values
  • Timeout must be long enough to allow
    acknowledgement to arrive under worst case delays
  • Tprop Propagation delay of the link
  • Tf Frame transmission time (bits/frame)/(bits/se
    cond)
  • Tproc Processing delay to receive a frame
  • Tout gt 2Tf2TpropTproc

Figure 5.19
26
Selective Repeat ARQ
  • Each error in go back N ARQ may cause
    retransmission of many frames.
  • Not effective in high error rate channels
  • Long Tprop requires large window and large
    timeout delays
  • Reduces efficiency.
  • Solution is to not throw away correct frames
    which arrive with wrong sequence number
  • Receiver must be able to request selective repeat
    of missing frames.
  • Receiver must buffer frames received out of
    sequence.

27
Selective repeat ARQ
28
Selective Repeat ARQ
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 2
fr 8
fr 7
fr 6
fr 9
fr 10
fr 11
fr 12
A
B
ACK2
NAK2
ACK1
ACK7
ACK8
ACK9
ACK10
ACK11
ACK12
ACK2
ACK2
ACK2
error
  • Receiver continues to send rnext in all
    acknowledgements
  • Sender re-sends only the request frame on NAK or
    timeout
  • Receiver advances rnext to first missing frame.

Figure 5.21
29
Sequence number confusion
Frame 0 resent
time
fr 0
fr 2
fr 1
fr 0
A
M224, Selective Repeat Send Window Receive
Window 3
B
ACK2
ACK3
ACK1
Looks like new frame 0, missing frame 3!
3,0,1
Receive Window
Frame 0 resent
time
fr 0
fr 1
fr 0
A
Send Window Receive Window 2
B
ACK2
ACK1
frame 0 rejected
Receive Window
2,3
Window lt 2m-1
Figure 5.22
30
Example ARQ Protocols
  • TCP Selective Repeat ARQ
  • IP level may lose packets or deliver out of order
  • Out of order delivery requires some modifications
  • SSCOP (ATM)
  • Originally designed for satelite links (long
    delay, modest bandwidth, high bandwidth x delay)
  • Useful for ATM (short delay, very high bandwidth,
    high bandwidth x delay)

31
Efficiency of Stop and Wait ARQ
t0
A
tproc
B
frame tf time
tprop
tprop
tack
tproc
t0 2 tprop 2 tproc tf tack 2 tprop 2
tproc nf/R na/R
Reff (nf-no)/t0
Figure 5.23
32
Stop and Wait ARQ Efficiency
  • Works well at modem speeds, not higher
  • Very large frame sizes are workable at LAN speeds
  • Nothing works with very fast links
  • Frame size divided by delay is the effective
    speed limit

33
Efficiencies with errors
Pf probability of a frame error ? nf pe
34
Window size required to keep link busy
  • Big window sizes mean big buffers
  • Fast links need other solutions
  • No link level ARQ (end-to-end rates are often
    much lower even though delay is higher
  • Forward error correction (error correcting codes)

35
Efficiency versus link errors
?
Selective Repeat
Go-Back-N
Stop Wait
p
  • Frame size of 8,192, 1.5Mb/s channel, 5ms delay
  • Stop and wait ARQ limited by bandwidth and delay
  • Others can achieve efficiency of 1 given low
    errors
  • High error rates and large frame cause all to
    perform poorly

Figure 5.24
36
Efficiency vs. Frame Size
?
Selective Repeat
Go-Back-N
17
32
62
10
6
3
3
Stop Wait
3
nf
  • Frame size of 8,192, 1.5Mb/s channel, 5ms delay,
    p10-4
  • Reducing frame size reduces frame error rate but
    also increases impact of overhead bits on
    efficiency

Figure 5.25
37
Sliding Window Flow Control
  • Receiver generally has limited capacity for
    receiving new data
  • Routers need to clear buffers by resending
  • Hosts may be limited by how fast applications
    consume data
  • Flow control required to prevent data loss
  • Dropping data at the receiver wastes resources
    (reduces carried load)
  • System can deadlock without controls (all buffers
    full of data waiting to be sent and nobody able
    to receive it)

38
On/off flow control
A
transmit
transmit
time
on
off
off
on
time
B
2Tprop
  • Receiver tells sender when to stop/start
  • Doesnt take effect until 2Tprop later
  • Suitable for links with low bandwidth ? delay
  • Example XON/XOFF
  • Receiver controls flow by sending special
    characters
  • Commonly used by terminals and PCs
  • Problems delay, and transparency (

Figure 5.26
39
Sliding window control
return of permits
tcycle
A
time
B
time
  • Sender is permitted to transmit up to a give
    sequence number without further permission
  • Receiver periodically returns permits advancing
    Ws
  • Like ARQ, but not tied to acknowledgements
  • need to acknowledge without advancing window to
    avoid unneeded retransmissions
  • Example TCP (and many other protocols)

Figure 5.27
40
Jitter in Synchronous streams
Synchronous source sends periodic information
blocks
Network output not periodic
Network
  • Packet delays differ due to buffering and
    variable routes
  • Timing of original stream is lost
  • Timestamps on packets allow receiver to determine
    timing
  • Sender and receiver clocks may differ
  • Receiver doesnt know how much delay the network
    introduces

Figure 5.28
41
Real time stream synchronization
receivers clock
arrival times
senders clock
clock time
send times
Receiver too slow buffer overflow
playout times
Tplayout
real time
playout delay
Receiver too fast buffer starvation
Receiver speed just right
clock time
clock time
Many late packets
Tplayout
Tplayout
real time
real time
Figure 5.29
42
Dynamic clock adjustment
Buffer for information blocks
Playout command
Error signal

Adjust frequency
Smoothing filter
Add
Recovered clock
t3
t1
t4
t2
-
Timestamps
Counter
  • Difference between timestamps and receivers
    clock used for adjustments
  • Smoothing needed to eliminate effects of jitter

Figure 5.30
43
Reliable Streams (TCP)
  • Network service is a byte stream
  • May be a single unit (e.g. a file)
  • May be open ended (e.g. a terminal session)
  • Protocol handles buffering, flow control, error
    correction, etc. invisible to the application.

Figure 5.32
44
HDLC Variants
Terminal-Host
Unbalanced Multipoint link
Responses
Commands
Multi-drop lines
Primary
Secondary
Secondary
Secondary
Host-Host
Figure 5.33
45
HDLC Frame Format
ITU-CRC
01111110
Variable
01111110
Flag
Address
FCS
Flag
Control
Information
  • Flag is a unique bit pattern
  • bit stuffing used to insure data doesnt
    duplicate it.
  • Address used to identify endpoint (multidrop)
  • Control determines frame type
  • Information (carries data)
  • Supervisory (acknowledgements and control of
    data)
  • Unnumbered (link control)
  • Information field can be any length
  • CRC computed over whole frame

Figure 5.35
46
HDLC Frame Formats
Information Frame
1
5
2-4
6-8
N(R)
0
N(S)
P/F
Frame sequence number (3 or 7 bits)
Acknowledged sequence number (3 or 7 bits)
Polling Control
Supervisory Frame
N(R)
1
0
S
S
P/F
0 0 Receiver Ready (acknowledgement) 0 1
Reject (negative acknowledgement go back to
N(R) 1 0 Receiver Not Ready (Acknowledge and
stop) 1 1 Selective Reject (retransmit only
frame N(R)
Unnumbered Frame
1
1
M
M
M
M
P/F
M
Various commands for setting link operation mode.
Figure 5.36
47
Link Control Example
Data transfer
SABM
UA
UA
DISC
  • SABM Set Asynchronous Balanced Mode
  • UA Unnumbered Acknowledgement
  • Data transfer (I Frames, Supervisory frames)
  • DISC Disconnect link

Figure 5.37
48
Multipoint data transfer Example
Secondaries B, C
Primary A
B, RR, 0, P
Poll B for data
B, I, 0, 0
B, I, 1, 0
X
B, I, 2, 0,F
Selective Reject frame 1 (no poll)
No more to send
B, SREJ, 1
C, RR, 0, P
Poll C for data
C, RR, 0, F
Nothing to send
Poll B for data (repeat reject)
B, SREJ, 1,P
B, I, 1, 0
B, I, 3, 0
B, I, 4, 0, F
No more to send
Acknowledge frames 0-4
B, I, 0, 5
Figure 5.38
49
HDLC Example (Balanced mode)
Combined Station A
Combined Station B
B, I, 0, 0
A, I, 0, 0
B, I, 1, 0
A, I, 1, 1
X
A, I, 2, 1
B, I, 2, 1
Reject frames after 1
B, I, 3, 2
B, REJ, 1
B, I, 4, 3
Discarded
A, I, 3, 1
B, I, 1, 3
B, I, 2, 4
B, RR, 2
ACK 1 and 2
B, I, 3, 4
B, RR, 3
ACK 3
Figure 5.39
50
Point-to-Point Protocol format
flag
Address
Flag
Control
Protocol
Information
CRC
01111110
01111110
1111111
00000011
All stations are to accept the frame
Unnumbered frame
Specifies what kind of packet is contained in the
payload, e.g., LCP, NCP, IP, OSI CLNP, IPX
  • Byte framed (flags in data are escaped with a
    character)
  • Normally unnumbered
  • No sequence numbers or error control
  • Can use HDLC-like control on noisy links
  • Part of a family of protocols for internet links
  • PAP/CHAP password authentication
  • LCP/NCP link establishment and networking

Figure 5.40
51
Link Sharing using a Multiplexer
(a)
A1
A2
Dedicated Lines
B1
B2
C2
C1
(b)
Shared Line
A2
B1
B2
C2
C1
A1
  • Packets from dedicated links combined on a shared
    link (carrying all the load)
  • Packets are buffered and delayed in the
    multiplexer
  • Buffering time depends on relative arrival and
    departure rates
  • Finite buffering results in packet loss.

Figure 5.43
52
A Multiplexer model (M/M/1/K)
K buffers
Link rate
Service Rate
?
Arrival Rate ? (total for all inputs)
Packet Size
??/?
ET EN/(?(1-Ploss))
Ploss (1-?)?K/(1-?K1)
EN ?/(1-?)- (K1)?K1/(1-?K1)
53
Delay for a 10 buffer multiplexer
Normalized average delay
Load
Figure 5.46
54
Loss for a 10 buffer multiplexor
Loss probability
Load
Figure 5.47
55
Delay versus load (infinite buffers)
M/M/1
Normalized average delay
M/D/1
Load
M/M/1 Exponential service times (packet
sizes) M/D/1 Fixed service times (packet sizes)
Figure 5.48
56
Effects of Packet Headers
L1200
L800
Average Delay (seconds)
L400
L200
Goodput (bits/second)
  • Goodput bits/second of user data
  • Chart shows 40 bytes/header, 64K bits/second
    link, and various packet sizes
  • Short packets have lower delay at moderate load
    (why?) but maximum goodput (why?)

Figure 5.49
57
A Speech Multiplexor
Many Voice Calls
Fewer Trunks
Part of this burst is lost
  • Trunks are only needed when someone is speaking.
  • 40 of the time in normal telephone speech
  • Also silences between words (short)
  • Multiplexer assigns trunks only when needed
  • Time Assignment Speech Interpolation (TASI)
  • Was used on scarce circuits like undersea cables

Figure 5.50
58
Speech loss in TASI Systems
Trunks
Speech loss
48
40
32
24
connections
  • About half the trunks, with loss of lt1
  • Same model applies to voice in packets

Figure 5.51
59
For Next week
  • Problem set
  • Read Chapter 6 (We may not cover all of it)
Write a Comment
User Comments (0)
About PowerShow.com