multiplexed link L1 B1 - MIT OpenCourseWare · Networks encounter a vast range of Data rates...
Transcript of multiplexed link L1 B1 - MIT OpenCourseWare · Networks encounter a vast range of Data rates...
Boston Switch
Los AngelesSwitch
multiplexed link
shared switches
B1
B2
B3
L1
L2
L3 L4
Principles of Computer System Design © Saltzer & Kaashoek 2009
5,624 bit times Time
8-bit frame 8-bit frame 8-bit frame
Principles of Computer System Design © Saltzer & Kaashoek 2009
D
Personal Computer service A
B multiplexed
link data crosses thislink in bursts andcan tolerate variable delay
C
Principles of Computer System Design © Saltzer & Kaashoek 2009
frame
Time B D
Guidance 4000 bits 750 bits information
Principles of Computer System Design © Saltzer & Kaashoek 2009
A packet
Workstationat network attachment
Packet Switch Packet
Switch
Packet Switch
PacketSwitch
1
2 3
B
Service at networkpoint A attachment point B
B
Principles of Computer System Design © Saltzer & Kaashoek 2009
------------maximum
tolerable delayaverage 1queuing 1 – ρdelay
1
100%0 Utilization, r rmax
Principles of Computer System Design © Saltzer & Kaashoek 2009
send request,set timer
receive response,reset timer
send request,set timer
timer expires,resend request,set new timer
receive response,reset timer
A B
request 1 time
response 1
X
request 2 overloadedX forwarder discards requestpacket.
request 2’
response 2’ X
Principles of Computer System Design © Saltzer & Kaashoek 2009
A send request,
set timer
timer expires,resend request,set new timer
receive response, Xreset timer
request 3
X request 3
response 3’
’
B
overloaded forwarderdiscards response 3
duplicate arrives at BB sends response 3’
Principles of Computer System Design © Saltzer & Kaashoek 2009
A send request,
set timer
timer expires,resend receive Xresponse,
reset timer
receiveduplicateresponse
request 4
request 4’
response 4
response 4’
B
packet containing responsegets delayed
duplicate arrives at BB sends response 4’
Principles of Computer System Design © Saltzer & Kaashoek 2009
Application characteristics
isochronous (e.g., telephone
network)
NetworkType
asynchronous(e.g., Internet)
Continuous stream
(e.g., interactivevoice)
(hard-edged)wastesgood match either acceptscapacity or blocks call
(gradual)variable latency 1 variable delay
good matchupsets 2 discards data application 3 rate adaptation
Bursts of data (most
computer-to-computer data)
Responseto load
variations
Principles of Computer System Design © Saltzer & Kaashoek 2009
Networks encounter a vast range of
Data rates Propagation, transmission, queuing, and processing delays. Loads Numbers of users
Networks traverse hostile environments
Noise damages dataLinks stop working
Best-effort networks have
Variable delaysVariable transmission ratesDiscarded packetsDuplicate packetsMaximum packet lengthReordered delivery
Principles of Computer System Design © Saltzer & Kaashoek 2009
result ← FIRE (#, target, action) procedure FIRE (nmiss, where, react)... return result
Client stub Service stub
proc: FIRE
args: 3
type: integer value: 2
type: string value: “Lucifer”
type: procedure value: EVADE
Preparerequestmessage.Send to service
Receive requestmessage.Call requestedprocedure.Prepare responsemessage.Send to client.
response:
acknowledgment
type: string value: “destroyed”
request:
Wait for response.
Principles of Computer System Design © Saltzer & Kaashoek 2009
Main program
RPC client stub
application protocol
presentation protocol
called procedure
RPC service stub
Principles of Computer System Design © Saltzer & Kaashoek 2009
Main program application protocol
fire (return)(return) fire
presentation protocol
called procedure
RPC service stub
Client networkpackage
RPC client stub
Service networkpackage
send_send_ receive_ receive_ messagemessage message message
transport protocol
Principles of Computer System Design © Saltzer & Kaashoek 2009
Layer One A B C D
Layer Two J K L
Layer Three X Y Z
Principles of Computer System Design © Saltzer & Kaashoek 2009
DATA
LINK_SEND (pkt, link2) NETWORK_HANDLE
A B
DATA LH LT LinkLayer
link 2link 1LinkLayer link link
protocolprotocol
C
LinkLayer
Principles of Computer System Design © Saltzer & Kaashoek 2009
NETWORK_SEND (segment
DATA
, “IP”, nap_1197)
NetworkLayer
network
protocolNetworkLayer
LINK_SEND (packet, link5) lINK_SEND (packet, link2
DATANT NH
) NETWORK_HANDLE
LinkLayer
link5DATANT NH LHLT
link 2 linkprotocol
LinkLayer
LinkLayer
Principles of Computer System Design © Saltzer & Kaashoek 2009
FIRE (7, “Lucifer”, evade) DATA
end-to-end
protocol
Network Layer
End-to-End Layer
DATAET EH
(RPC)
Network Layer
DATANT NHET EH
LinkLayer
DATANT NH LHLT
LinkLayer
LinkLayer
ET EH
FIRE (7, “Lucifer”, evade)
End-to-End Layer(RPC)
NetworkLayer
LinkLayer
Principles of Computer System Design © Saltzer & Kaashoek 2009
The end-to-end argument
The application knows best.
Principles of Computer System Design © Saltzer & Kaashoek 2009
Gnutella (network layer)
Transport Protocol (end-to-end layer) Internet Protocol (network layer)
dialed connection (end-to-end layer) telephone switch (network layer)
(link
physical wire (link layer)
File Transfer Program (end-to-end layer)
layer)
layer)(link
File transfer system
Internet
dial-uptelephonenetwork
Principles of Computer System Design © Saltzer & Kaashoek 2009
data
A Bready
acknowledge
Principles of Computer System Design © Saltzer & Kaashoek 2009
V 1 0 1 0 1 0 1 0 1
time
Principles of Computer System Design © Saltzer & Kaashoek 2009
A B
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure FRAME_TO_BIT (frame_data, length) ones_in_a_row = 0 for i from 1 to length do // First send frame contents
SEND_BIT (frame_data[i]); if frame_data[i] = 1 then
ones_in_a_row ← ones_in_a_row + 1;if ones_in_a_row = 6 then
SEND_BIT (0); // Stuff a zero so that data doesn’t ones_in_a_row ← 0; // look like a framing marker
else ones_in_a_row ← 0;
for i from 1 to 7 do // Now send framing marker. SEND_BIT (1)
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure BIT_TO_FRAME (rcvd_bit) ones_in_a_row integer initially 0 if ones_in_a_row < 6 then bits_in_frame ← bits_in_frame + 1frame_data[bits_in_frame] ← rcvd_bitif rcvd_bit = 1 then ones_in_a_row ← ones_in_a_row + 1else ones_in_a_row ← 0
else // This may be a seventh one-bit in a row, check it out. if rcvd_bit = 0 then ones_in_a_row ← 0 // Stuffed bit, don't use it.
else // This is the end-of-frame marker LINK_RECEIVE (frame_data, (bits_in_frame - 6), link_id) bits_in_frame ← 0 ones_in_a_row ← 0
Principles of Computer System Design © Saltzer & Kaashoek 2009
Network protocol
Standard Highrobustness
protocolprotocol Experimental
protocol
Network Layer
Link Layer
Principles of Computer System Design © Saltzer & Kaashoek 2009
Network Layer
Link Layer
Internet Protocol
AppletalkProtocol
Path Vector
ExchangeProtocol
Address Resolution
Protocol
Standard Highrobustness
protocolprotocol Experimental
protocol
Principles of Computer System Design © Saltzer & Kaashoek 2009
structure frame structure checked_contents
bit_string net_protocol // multiplexing parameter bit_string payload // payload data
bit_string checksum
procedure LINK_SEND (data_buffer, link_identifier, link_protocol, network_protocol) frame instance outgoing_frame outgoing_frame.checked_contents.payload ← data_buffer outgoing_frame.checked_contents.net_protocol ← data_buffer.network_protocol frame_length ← LENGTH (data_buffer) + header_length outgoing_frame.checksum ← CHECKSUM (frame.checked_contents, frame_length) sendproc ← link_protocol[that_link.protocol] // Select link protocol. sendproc (outgoing_frame, frame_length, link_identifier) // Send frame.
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure LINK_RECEIVE (received_frame, length, link_id) frame instance received_frame if CHECKSUM (received_frame.checked_contents, length) =
received_frame.checksum then // Pass good packets up to next layer. good_frame_count ← good_frame_count + 1; GIVE_TO_NETWORK_HANDLER (received_frame.checked_contents.payload,
received_frame.checked_contents.net_protocol); else bad_frame_count ← bad_frame_count + 1 // Just count damaged frame.
// Each network layer protocol handler must call SET_HANDLER before the first packet // for that protocol arrives…
procedure SET_HANDLER (handler_procedure, handler_protocol) net_handler[handler_protocol] ← handler_procedure
procedure GIVE_TO_NETWORK_HANDLER (received_packet, network_protocol) handler ← net_handler[network_protocol] if (handler ≠ NULL) call handler(received_packet, network_protocol) else unexpected_protocol_count ← unexpected_protocol_count + 1
Principles of Computer System Design © Saltzer & Kaashoek 2009
networkattachment
Network
0107
24
16
11
39
33
35
40
41
42 network
point
address
Principles of Computer System Design © Saltzer & Kaashoek 2009
structure packetbit_string sourcebit_string destinationbit_string end_protocolbit_string payload
procedure NETWORK_SEND (segment_buffer, destination, network_protocol, end_protocol)
packet instance outgoing_packet outgoing_packet.payload ← segment_buffer outgoing_packet.end_protocol ← end_protocol outgoing_packet.source ← MY_NETWORK_ADDRESS
outgoing_packet.destination ← destination NETWORK_HANDLE (outgoing_packet, net_protocol)
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure NETWORK_HANDLE (net_packet, net_protocol) packet instance net_packet if net_packet.destination ≠ MY_NETWORK_ADDRESS then
next_hop ← LOOKUP (net_packet.destination, forwarding_table)LINK_SEND (net_packet, next_hop, link_protocol, net_protocol)
else GIVE_TO_END_LAYER (net_packet.payload,
net_packet.end_protocol, net_packet.source)
Principles of Computer System Design © Saltzer & Kaashoek 2009
Segment presented tothe network layer DATA
Packet presented tothe link layer DATAend
protocol source &
destination
frame check frameDATAend protocol
Frame appearingon the link
source & destination sum
network protocolmark mark
1111111 97142 1111111“Fire”RPCExample 41 —> 24 55316IP
Principles of Computer System Design © Saltzer & Kaashoek 2009
B
4
1
H
1
G
K
2 5A 1
C
113source
4 2 3
destination
F
1
2 4 51 5
J
E2
1
3 3 114
D
2
Principles of Computer System Design © Saltzer & Kaashoek 2009
B
C
A 1 1 H 4
1
3
F 5 J 1
2 E
destination link
G
K
source 1
2
D
5
3 4 5
1
2
2
34
1
2
31
1
1
4
destination
A end-layerall other 1
Principles of Computer System Design © Saltzer & Kaashoek 2009
destination link
A 1
C D E F
H J K
2
3
4
2 3 4
2
4
B
G end-layer
G
K
J
source 1
2 3
A
B
C
D
E
F
4
5
3 4 5
1
2
1 2
34
1
2
35
1
1
1 1
1
12
4
H
destination
Principles of Computer System Design © Saltzer & Kaashoek 2009
C
B
A 11
4
1
H
1
G
K 2
2 5
1source 3
4 2 3
destination1
4 5F 51J
E
12
3 3 14
21
D
to path
G < >
Principles of Computer System Design © Saltzer & Kaashoek 2009
B
A 1 C
1
source
destination
F
E
D
G
K
J
1
2 3
4
5
4 5
21
3 1
2
1 3
4
1
2
351 1
12
4
H
From A, From H, From J, From K,via link 1 via link 2: via link 3: via link 4:
to path to path to path to path A < > H < > J < > K < >
Principles of Computer System Design © Saltzer & Kaashoek 2009
B
A 11
1 C
D
4
1
HG
K
2
342
2 5
1source 3
4 3
1 destination
5F 51 J
E
12
3 14
21
path vector forwarding table to AGHJK
path to <A> A < > G<H> H<J> J<K> K
link
1end-layer
234
Principles of Computer System Design © Saltzer & Kaashoek 2009
G
K
J
source 1
2 3
D F
4
5
3 4 5
1
2
1 2
34
1
2
35
1
1
1
1
1
4
H
destination
B
C
1A
2 E
From A, From H, From J, From K,via link 1 via link 2: via link 3: via link 4: to path to path to path to path A < > B <D> E<B> D <E>G <G> C <C> E <E> F <F>G <G> G <G> G <G>H < > H <H> H <H>J <J> J < > <J>K <K> K <K> K
J< >
Principles of Computer System Design © Saltzer & Kaashoek 2009
forwarding tablepath vector
G
K
J
source 1
2 3
A
B
C
D
E
F
4
5
3 4 5
1
2
1 2
34
1
2
35
1
1
1 1
1
12
4
H
destination
to
ABCDEFGHJK
path <A>
<H, B><H, C><J, D><J, E><K, F>
< ><H><J><K>
to
ABCDEFGHJK
link
122334
end-layer234
Principles of Computer System Design © Saltzer & Kaashoek 2009
// Maintain routing and forwarding tables.
vector associative array // vector[d_addr] contains path to destination d_addr neighbor_vector instance of vector // A path vector received from some neighbor my_vector instance of vector // My current path vector. addr associative array // addr[j] is the address of the network attachment
// point at the other end of link j. // my_addr is address of my network attachment point. // A path is a parsable list of addresses, e.g. {a,b,c,d}
procedure main() // Initialize, then start advertising. SET_TYPE_HANDLER (HANDLE_ADVERTISEMENT, exchange_protocol) clear my_vector; // Listen for advertisements do occasionally // and advertise my paths
for each j in link_ids do // to all of my neighbors. status ← SEND_PATH_VECTOR (j, my_addr, my_vector, exch_protocol) if status ≠ 0 then // If the link was down,
clear new_vector // forget about any paths FLUSH_AND_REBUILD (j) // that start with that link.
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure HANDLE_ADVERTISEMENT (advt, link_id) // Called when an advt arrives. addr[link_id] ← GET_SOURCE (advt) // Extract neighbor’s address neighbor_vector ← GET_PATH_VECTOR (advt) // and path vector. for each neighbor_vector.d_addr do // Look for better paths. new_path ←{addr[link_id], neighbor_vector[d_addr]} // Build potential path. if my_addr is not in new_path then // Skip it if I’m in it.
if my_vector[d_addr] = NULL) then // Is it a new destination? my_vector[d_addr] ← new_path // Yes, add this one.
else // Not new; if better, use it. my_vector[d_addr] ← SELECT_PATH (new_path, my_vector[d_addr])
FLUSH_AND_REBUILD (link_id)
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure SELECT_PATH (new, old) // Decide if new path is better than old one. if first_hop(new) = first_hop(old) then return new // Update any path we were
// already using. else if length(new) ≥ length(old) then return old // We know a shorter path, keep else return new // OK, the new one looks better.
procedure FLUSH_AND_REBUILD (link_id) // Flush out stale paths from this neighbor. for each my_vector,d_addr
if first_hop(my_vector[d_addr]) = addr[link_id] and new_vector[d_addr] = NULL
then delete my_vector[d_addr] // Delete paths that are not still advertised.
REBUILD_FORWARDING_TABLE (my_vector, addr) // Pass info to forwarder.
Principles of Computer System Design © Saltzer & Kaashoek 2009
region R1
to
region R2R1.B
R3.C
R1.C
32
R1.D
1 R1.A forwarding table in R1.B
region forwarding local forwardingsection section
R1R2R3R4
region R3 region R4
link to
local R1.A1 R1.B1 R1.C3 R1.D
link
1end-layer
23
Principles of Computer System Design © Saltzer & Kaashoek 2009
sender send first segment
receive ACK,send second segment
receive ACK,send third segment
(repeat N times)
Done.
segment 1
segment 2 ACK 1
ACK 2
3 ••• N
ACK N
receiver time
accept segment 1
accept segment 2
accept segment N
Principles of Computer System Design © Saltzer & Kaashoek 2009
sendersend segment 1send segment 2send segment 3
receive ACK 1receive ACK 2
(repeat N times)
receive ACK N, done.
segment 1
ack 1
2
ack N
ack 2
3
• •
N •
receiver
time
acknowledge segment 1acknowledge segment 2
acknowledge segment N
Principles of Computer System Design © Saltzer & Kaashoek 2009
receive permission,send segment 1send segment 2send segment 3send segment 4
receive ACK 1receive ACK 2receive ACK 3receive ACK 4,
wait … receive permission,
send segment 5send segment 6
sender receiver
segment #1 #2
ack # 2
#3
may I send?
yes, 4 segments
send 4 more
segment #5 #6
• • •
ack # 1
ack # 3 ack # 4
#4
time receive request,open a 4-segmentwindow
buffer segment 1buffer segment 2buffer segment 3buffer segment 4
finished processingsegments 1–4, reopenthe window
buffer segment 5buffer segment 6
Principles of Computer System Design © Saltzer & Kaashoek 2009
usefulworkdone
unlimited resource
limited resourcewith no waste
congestioncollapse
capacityof a limited resource
offered load
Principles of Computer System Design © Saltzer & Kaashoek 2009
duplicate acknowledgmentreceived
decrease additive
increase
multiplicative
delayWindow
size
slow start,again
timerexpires,stop sending
slow start
Time
Principles of Computer System Design © Saltzer & Kaashoek 2009
leader destination source type data checksum 64 bits 48 bits 48 bits 16 bits 368 to 12,000 bits 32 bits
Principles of Computer System Design © Saltzer & Kaashoek 2009
Station Identifier(Ethernet
17 24 12 05 19 Address)
Principles of Computer System Design © Saltzer & Kaashoek 2009
procedure ETHERNET_HANDLE (net_packet, length) destination ← net_packet.target_id if destination = my_station_id or destination = BROADCAST_ID then
GIVE_TO_END_LAYER (net_packet.data, net_packet.end_protocol, net_packet.source_id)
else ignore packet
Principles of Computer System Design © Saltzer & Kaashoek 2009
upper-layer network address
Ethernet station identifier
link identifier
Ethernet
server routerwork station
work station
work station
work station
1 61111 17 18 14 22 1915
L M N P Q K 1
… 2 34 5
G
H J
E
F
Principles of Computer System Design © Saltzer & Kaashoek 2009
upper-layer network address link identifier G
L M N P work
station
1
Q K H J
server work
station station station work work
1 111 E 17 15 18 14 22 19
FEthernetEthernet station identifier
router
6
1
… 2 34 5
internetaddress
M N P QK E
Ethernet/station
enet/15enet/18enet/14enet/22enet/19enet/19
Principles of Computer System Design © Saltzer & Kaashoek 2009
upper-layer network address link identifier
workstation
1
L M N P Q
server work
station
11
work station
1
work station
1 17 15 18 14 22
Ethernet Ethernet station identifier
internet Ethernet/ internet address station address
M enet/15 M E
K
router
6
1
… 2 34 5
19
Ethernet/station
enet/15enet/19
G
H J
E
F
Principles of Computer System Design © Saltzer & Kaashoek 2009