L4 - Switching
L4 - Switching
El Mehdi Amhoud
College of Computing
Mohammed VI Polytechnic University
College of
Computing
Pr. Amhoud
The network core
• Mesh of interconnected routers mobile network
national or global ISP
enterprise
network
routing College of
Computing
Pr. Amhoud
forwarding
forwarding
College of
Computing
Pr. Amhoud
Introduction
• Switching methods are used in LAN networks
Mesh : Direct point to point
Star : central controller
Bus: multipoint configuration
Ring: circular configuration
• Previous configurations are not adapted to larger networks
College of
Computing
Pr. Amhoud
5
Introduction : Switching at different layers
• Switching at the Physical layer
• Only circuit switching
6
Introduction & Outline
Switch based
networks
7
Circuit-switched networks
• Set of switches connected by physical links (cables)
• Circuit switching is done at the physical layer
• A connection between 2 switches can have 1 or more links
• Each link can be divided to N FDM (Frequency division multiplexing) or TDM (time division
multiplexing) channels
College of
• Each connection uses only one dedicated channel on each link Computing
Pr. Amhoud
• 3 Transmission phases:
Setup phase
Data transfer
Teardown phase
8
Circuit-switched networks
College of
Computing
Pr. Amhoud
9
Circuit switched networks : Transmission phases
Setup phase:
• A dedicated link needs to be established
• Host A makes a request of connection to host B Host A
• Request must be accepted by all switches between A & B
• Each switch finds the dedicated channel to the next switch
• An Acknowledgment is sent from B to A in opposite direction and resources
(links & channels) are booked for this communication College of1
Computing 2
• Transfer can start Pr. Amhoud
• Example: Telephone
Data transfer: 3
Data is not packetized, continuous flow
Teardown phase:
A or B can teardown the communication Host B
Signal is sent to all switches to release resources
10
Circuit switched networks : Performance
Example 1: Circuit switched network using a 4 × 4 switch
College of
Computing
Pr. Amhoud
11
Circuit switched networks : Performance
Example 2: Circuit switched network using a 4 × 8 switch
College of
Computing
Pr. Amhoud
12
Circuit switched networks : Performance
Efficiency:
• Low efficiency: Resource allocated during the entire communication
• Telephone: Resources released after finishing communication
• Computers can be connected without an activity
Delay:
College of
Allocated resources : Assume there is No delay during data Computing
transfer at switches, Pr. Amhoud
what is the total delay for a circuit switched communication ?
13
Structure of a circuit switch
Circuit switches:
• Crossbar switch: Connects N inputs to M outputs in a grid ( using electronic transistors )
N × M crosspoints are required (example: N=M=1000, 1 million crosspoint)
Impractical and complex
Loss of material ( in practice , not all users use resources at same time. Example : telephone)
College of
Computing
Pr. Amhoud
3x4 switch
6x6 switch
14
Structure of a circuit switch
• Multistage switch: Combines the crossbar switch in 3 stages
n
n
n×k k×n
N/n × N/n
⋮ ⋮ ⋮
N n College of
Computing
n Pr. Amhoud
n
n×k k×n
N × N switch N/n × N/n
1st stage 2nd stage 3rd stage
with N /n with 𝐤 with N /n
Total number of cross-points ? crossbars crossbars crossbars
𝑁 N N 𝑁 𝑁
n×k +k × + n × k = 2𝑘𝑁 + 𝑘( )2
𝑛 n n 𝑛 𝑛
15
Packet switched networks
College of
• At Switch/Router: Computing
First packet arrived is first served Pr. Amhoud
No scheduled processing time
Each packet is processes independently from others
❑ Delay / Loss can occur
16
Packet switched networks
17
Packet switched networks : Performance
• Every packet contains a header that has the destination address Destination Output port
address
• The destination address remains the same during transmission
1000 2
Efficiency:
1500 1
• Better than circuit switched networks
2000 3
• Resources allocated only when there are packets to transmit
…. College of
….
• If there is a delay between 2 packets, then this delay can be used to Computing
transmit packets from other messages
Pr. Amhoud
2
1
3
4
18
Packet switched networks : Performance
Example:
Host-A Host-B
Transmission
time
Waiting Total
time delay
College of
Computing
Pr. Amhoud
Delay:
Delay is not uniform for all packets
TOTAL DELAY : 3 d𝑡𝑟ans +3 d𝑝rop + W1 +W2
Waiting time at a router before forwarding
𝑑𝑡𝑟 : transmission time
Find total delay when 2 routers are involved ??
𝑑𝑝rop : propagation delay
Wi: waiting time at router i
19
Packet-switching: store-and-forward
L bits
per packet
3 2 1
source destination
R bps R bps
• packet transmission delay: takes L/R seconds to transmit (push out) L- College of
bit packet into link at R bps Computing
• store and forward: entire packet must arrive at router before it can be Pr. Amhoud
transmitted on next link One-hop numerical example:
▪ L = 10 Kbits
▪ R = 100 Mbps
▪ one-hop transmission delay = 0.1
msec
20
Packet-switching: store-and-forward
L bits
per packet
3 2 1
source destination
R bps R bps
• packet transmission delay: takes L/R seconds to transmit (push out) L- College of
bit packet into link at R bps Computing
• store and forward: entire packet must arrive at router before it can be Pr. Amhoud
transmitted on next link
Exercise:
1. End-to-end transmission time of 1 packet ? Solution:
2. End-to-end transmission time of all the 3 packets ? 1. 2L/R
3. End-to-end transmission time for 1 packet over a path made of N links ? 2. 4L/R
21
Packet-switching: queueing
R = 100 Mb/s
A C
D
B R = 15 Mb/s
E
queue of packets
Queueing in real life? waiting for transmission College of
over output link Computing
Cause ?
Queueing occurs when work arrives faster than it can be serviced:Pr. Amhoud
22
Packet-switching: queueing
R = 100 Mb/s
A C
D
B R = 15 Mb/s
loss in real life?
E
queue of packets
waiting for transmission College of
over output link Computing
Pr. Amhoud
Packet queuing and loss: if arrival rate (in bps) to link exceeds transmission rate (bps) of link for some
period of time:
• packets will queue, waiting to be transmitted on output link
• packets can be dropped (lost) if memory (buffer) in router fills up
23
How do packet delay and loss occur?
▪ packets queue in router buffers, waiting for turn for transmission
▪ queue length grows when arrival rate to link (temporarily) exceeds output link capacity
▪ packet loss occurs when memory to hold queued packets fills up
Pr. Amhoud
A
B
packets in buffers (queueing delay)
free (available) buffers: arriving packets
dropped (loss) if no free buffers
24
Packet delay: four sources
transmission
A propagation
B Processing
Queueing
College of
dTotal = dprocess + dqueue + dtrans + dprop Computing
Pr. Amhoud
25
Packet delay: four sources
transmission
A propagation
B processing
queueing
College of
dTotal = dprocess + dqueue + dtrans + dprop Computing
Pr. Amhoud
100 km 100 km
▪ car ~ bit; caravan ~ packet; toll service ~ link ▪ time to “push” entire caravan
College of through toll
transmission booth onto highway =?
Computing
27
Caravan analogy
100 km 100 km
College of
▪ suppose cars now “propagate” at 1000 km/hr Computing
▪ and suppose toll booth now takes one min to service a car Pr. Amhoud
▪ Q: Will cars arrive to 2nd booth before all cars serviced at first booth?
A: Yes! after 7 min, first car arrives at second booth; three cars still at first booth
28
Packet queueing delay
La/R -> 1 29
Packet loss
College of
buffer Computing
(waiting area) packet being transmitted
A Pr. Amhoud
B
packet arriving to
full buffer is lost
30
Throughput
▪ throughput: rate (bits/time unit) at which bits are being sent from sender to receiver
• instantaneous: rate at given point in time
• average: rate over longer period of time
College of
Computing
Pr. Amhoud
link
pipecapacity
that can carry link that
pipe capacity
can carry
server sends bits
fluid at rate
Rs bits/sec Rfluid at rate
c(Rbits/sec
(fluid) into pipe
(Rs bits/sec) c bits/sec)
31
Throughput
Rs bits/sec Rc bits/sec
Pr. Amhoud
Rs bits/sec Rc bits/sec
bottleneck link
link on end-end path that constrains end-end throughput
32
Throughput: network scenario
34
Virtual circuit networks
Virtual circuit identifier (VCI): small number used at the switch level
The VCI of a frame changes after each Switch
College of
Computing
Pr. Amhoud
Input Output
data 10 data 20 2 data 5
1 Port VCI Port VCI
1 20 2 5
1 10 3 50
3 data 50
35
Virtual circuit networks
S3
Input Output
Setup phase: Port VCI Port VCI
host A sends a request to destination B and waits for an 2 20 3 -
Ack
S1 S2
Input Output Input Output
Port VCI Port VCI Port VCI Port VCI
1 20 3 50 1 50 2 20
37
Virtual circuit networks
Transmission phase :
All switches use their table to forward packets from A to B A
S1 S3
Teardown phase : 1 2
3 B
Host A sends a special message called teardown request VCI=70
3 2
Host B sends a teardown confirmation, and all switches S2
delete their tables. 2
1 College of
Computing
Delay :
transmission time , propagation time, setup, teardown
38
Application 1: throughput
• What is the maximum throughput achievable between sender and receiver in the scenario shown
below?
College of
Computing
39
Application 1b: end-to-end throughput
40
Application 1b: end-to-end throughput
41
Application 2: end-to-end delay
42
Application 2: end-to-end delay
43
Application 3: Circuit switching
• Consider the circuit-switched network shown in the figure
below, with circuit switches A, B, C, and D. The number of
circuits between each two switches is shown in the figure
Introduction: 1-44
Application 3: Circuit switching
• Consider the circuit-switched network shown in the figure
below, with circuit switches A, B, C, and D. The number of
circuits between each two switches is shown in the figure
Introduction: 1-45
Application exercises
Circuit switching:
A path in a digital circuit-switched network has a data rate of 1 Mbps. The exchange of 1000 bits is required for the setup
and teardown phases. The distance between two parties is 5000 km. Answer the following questions if the propagation
speed is 2 × 108 m/s:
a. What is the total delay if 1000 bits of data are exchanged during the data-transfer phase?
College of
b. What is the total delay if 100,000 bits of data are exchanged during the data-transfer Computing
phase?
Pr. Amhoud
c. What is the total delay if 1,000,000 bits of data are exchanged during the data-transfer phase?
d. Find the delay per 1000 bits of data for each of the above cases and compare them. What can you infer?
46
Application exercises
VCI vs Routing table
1. Can a routing table in a datagram network have two entries with the same destination address? Explain.
47