BCSE308L Computer Networks
Module 2
Circuit and Packet Switching
Switched Communications Networks – Circuit Switching
– Packet Switching – Comparison of Circuit Switching and
Packet Switching – Implementing Network Software,
Networking Parameters(Transmission Impairment, Data
Rate and Performance)
Acknowledgement-slides from
Data Communications and Networking by B. Forouzan,
Fourth Edition , Mc Graw Hill,2007
SWITCHING
• Whenever we have multiple devices, we have the problem of how to
connect them to make one-to-one communication possible.
• One solution is to make a point-to-point connection between each pair
of devices (a mesh topology) or between a central device and every
other device (a star topology).
• The number and length of the links require too much infrastructure to
be cost-efficient, and the majority of those links would be idle most of
the time
SWITCHING
• A switched network consists of a series of interlinked nodes,
called switches.
• Switches are devices capable of creating temporary
connections between two or more devices linked to the
switch.
• In a switched network, some of these nodes are connected to
the end systems (computers or telephones, for example).
• Others are used only for routing
Switched network
SWITCHING AND TCP/IP
LAYERS
Physical Layer– Circuit Switching
There are no packets exchanged at the physical layer. The
switches at the physical layer allow signals to travel in one path or
another.
Data-Link Layer -packet switching
However, the term packet in this case means frames or cells.
Packet switching at the data-link layer is normally done using a
virtual-circuit approach.
Network Layer -packet switching
either a virtual-circuit approach or a datagram approach can be
used.
Currently the Internet uses a datagram approach,
Application Layer -message switching (more conceptual)
The communication at the application layer occurs by exchanging
messages.
Conceptually, we can say that communication using e-mail is a
kind of message-switched communication, but we do not see any
network that actually can be called a message-switched network.
Taxonomy of switched networks
CIRCUIT-SWITCHED NETWORKS
A circuit-switched network consists of a set of
switches connected by physical links. A connection
between two stations is a dedicated path made of one
or more links.. However, each connection uses only
one dedicated channel on each link.. Each link is
normally divided into n channels by using FDM or
TDM.
Topics discussed in this section:
Three Phases
Efficiency
Delay
Circuit-
Not
e
A circuit-switched network is made of a
set of switches connected by physical
links, in which each link is
divided into n channels.
A trivial circuit-switched network
Example
As a trivial example, let us use a circuit-switched
network to connect eight telephones in a small
area. Communication is through 4-kHz voice
channels. We assume that each link uses FDM to
connect a maximum of two voice channels. The
bandwidth of each link is then 8 kHz. Figure
shows the situation. Telephone 1 is connected to
telephone 7; 2 to 5; 3 to 8; and 4 to 6. Of course
the situation may change when new connections
are made. The switch controls the connections.
CIRCUIT SWITCHING
• Circuit switching takes place at the physical layer.
• Before starting communication, the stations must make a
reservation for the resources to be used during the
communication. These resources, such as channels
(bandwidth in FDM and time slots in TDM), switch
buffers, switch processing time, and switch input/output
ports, must remain dedicated during the entire duration of
data transfer until the teardown phase
• Data transferred between the two stations are not
packetized (physical layer transfer of the signal). The data
are a continuous flow sent by the source station and
received by the destination station, although there may be
periods of silence.
• There is no addressing involved during data transfer.
Note
In circuit switching, the resources need
to be reserved during the setup phase;
the resources remain dedicated for the
entire duration of data transfer until
the teardown phase.
CIRCUIT SWITCHING
• Three phases
• Set up -Before the two parties (or multiple parties in a
conference call) can communicate, a dedicated circuit
(combination of channels in links) needs to be established.
(when system A needs to connect to system M, it sends a
setup request that includes the address of system M, to
switch I. Switch I finds a channel between itself and switch
IV that can be dedicated for this purpose. Switch I then
sends the request to switch IV, which finds a dedicated
channel between itself and switch III. Switch III informs
system M of system A’s intention at this time)
• an acknowledgment from system M needs to be sent in the
opposite direction to system A. Only after system A
receives this acknowledgment is the connection established
CIRCUIT SWITCHING
• Three phases cntd…
• Data-Transfer Phase - After the establishment of the
dedicated circuit (channels), the two parties can
transfer data.
• Teardown Phase - When one of the parties needs to
disconnect, a signal is sent to each switch to release
the resources.
Delay in a circuit-switched network
• Efficiency
• It can be argued that circuit-switched networks
are not as efficient as the other two types of
networks because resources are allocated
during the entire duration of the connection.
These resources are unavailable to other
connections.
• Delay
• Minimal
• During data transfer the data are not delayed at
each switch; the resources are allocated for the
duration of the connection.
• there is no waiting time at each switch
• total delay = delay in setup + delay in data transfer +
delay in tear down
• Delay in setup = the propagation time of the source
computer request + the request signal transfer time +the
propagation time of the acknowledgment from the
destination computer +signal transfer time of the
acknowledgment
• Delay in data transfer =the propagation time + data
transfer time
• Delay in Tear down =the propagation time + Transfer
time of signal
Note
Switching at the physical layer in the
traditional telephone network uses
the circuit-switching approach.
In the jargon of telephony, this connection is called a circuit. When the network
establishes the circuit, it also reserves a constant transmission rate in the
network’s links (representing a fraction of each link’s transmission capacity) for
the duration of the connection. Since a given transmission rate has been
reserved for this sender-to-receiver connection, the sender can transfer the data
to the receiver at the guaranteed constant rate.
Packet Switching
Messages are split into packets of fixed size or
variable size.
Packet size is determined by underlying
network
No resource allocation for packet(no reserved
bandwidth on link, no scheduled processing
time at switches etc.)
two types of packet-switched networks:
datagram networks (connectionless packet
switching)
Virtual circuit networks. (connection-oriented packet
switching)
DATAGRAM NETWORKS
In data communications, we need to send messages
from one end system to another. If the message is
going to pass through a packet-switched network, it
needs to be divided into packets of fixed or variable
size.. The size of the packet is determined by the
network and the governing protocol.
Topics discussed in this section:
Routing Table
Efficiency
Delay
Datagram
Networks in
the Internet
Not
e
In a packet-switched network, there
is no resource reservation;
resources are allocated on demand.
DATAGRAM SWITCHING
• Datagram switching is done at network layer.
• Each packet is treated independently.
• Each packet is called datagram.
• Referred to as connectionless networks (switch (packet
switch) does not keep information about the connection
state)
• no setup or teardown phases
• Each packet is treated the same by a switch regardless of its
source or destination
• Packet Switching is beneficial only for small messages, but for
bursty data (large messages) Circuit Switching is better.
Connectionless Packet Switching
Network-Datagram Switching
Network
A connectionless
4 3 2 1 packet-swtiched
2 network
R1 1 R2
4
2
Sender 3
1 Network
3 3
4 R4 1 3 4 2
R3 R5 Out of order Receiver
Forwarding Process in Connectionless
Network Legend
SA: Source address
Routing table
Destination DA: Destination address
Output
address interface
A 1
B 2
H Send the packet
3 out of interface 2
Destination
address
SA DA Data SA DA Data
1 2
3 4
Delay in Connectionless Network
Destination
Souce
Total delay
2
Time Time Time Time
Not
e
A switch in a datagram network uses a
routing table that is based on the
destination address.
Not
e
The destination address in the header of
a packet in a datagram network
remains the same during the entire
journey of the packet.
Delay in a datagram network
Not
e
Switching in the Internet is done by
using the datagram approach
to packet switching at
the network layer.
DATAGRAM SWITCHING
Efficiency
• The efficiency of a datagram network is better than that of a
circuit-switched network; resources are allocated only when
there are packets to be transferred.
Delay
• There may be greater delay in a datagram network than in a
virtual-circuit network. Although there are no setup and
teardown phases, each packet may experience a wait at a
switch before it is forwarded. In addition, since not all packets
in a message necessarily travel through the same switches,
the delay is not uniform for the packets of a message
VIRTUAL-CIRCUIT NETWORKS
A virtual-circuit network is a cross between a circuit- switched
network and a datagram network. It has some characteristics
of both.
A virtual-circuit network is normally implemented in the data-
link layer, while a circuit-switched network is implemented in
the physical layer and a datagram network in the network layer.
Topics discussed in this section:
Addressing
Three Phases
Efficiency
Delay
Circuit-
Switched
Technology
Virtual-circuit network
Virtual-circuit network
A virtual-circuit network is a cross between a circuit-
switched network and a datagram network
As in a circuit-switched network, there are setup and
teardown phases in addition to the data transfer phase.
Resources can be allocated during the setup phase, as in
a circuit-switched network, or on demand, as in a
datagram network.
As in a datagram network, data are packetized and each
packet carries an address in the header. However, the
address in the header has local jurisdiction (it defines
what the next switch should be and the channel on which
the packet is being carried), not end-to-end jurisdiction.
As in a circuit-switched network, all packets follow the
same path established during the connection.
implemented in the data-link layer
Virtual-circuit network-
addressing
two types of addressing are involved:
global address
local (virtual-circuit identifier).
Global Addressing
A source or a destination needs to have a global address—an
address that can be unique in the scope of the network
Virtual-Circuit Identifier
The identifier that is actually used for data transfer is called the
virtual-circuit identifier (VCI) or the label.
A VCI, unlike a global address, is a small number that has only switch
scope; it is used by a frame between two switches.
A Connection Oriented Packet
Switched Network – Virtual Circuit
Legend
4 3 2 1 Packets
Network
Virtual circuit
A connection-oriented
packet-switched network
4 3 2 1 R1 R2
4
Sender
3
R5
2 Network
1
4 3 2 1 4 3 2 1
R3 R4
Receiver
Forwarding Process in a
Connection oriented Network
Routing Table
Legend
Incoming Outgoing
SA: Source address
Port Label Port Label DA: Destination address
1 L1 2 L2 L1, L2: Labels
L1 SA DA Data L2 SA DA Data
1 2
3 4
Incoming Outgoing
label label
Virtual-circuit identifier
Switch and tables in a virtual-circuit
network
Delay in a connection-
oriented network
Source Destination
1
Setup
3
Total delay
Transmission
time
4
6
Teardown
Time Time Time Time
Source-to-destination data transfer in a virtual-circuit network
Virtual-circuit network- phases
Three phases
Set up
Data Transfer
Tear Down
Virtual-circuit network- phases
Setup phase
the source and destination use their global
addresses to help switches make table entries for
the connection.
Set up Request and Acknowledgement
Set up Request
A setup request frame is sent from the source to
the destination
Acknowledgment
A special frame, called the acknowledgment
frame, completes the entries in the switching
tables
Sending request packet in a virtual-
circuit network
A to B Legend
Incoming Outgoing A to B Request packet
Network Port Label Port Label
Virtual circuit
1 14 3
1 R2
R1 2
A to B
1 4
3
A
R5 Network
2 A to B
1 2 3 2 3 4
A to B A to B
3 1 4
R3 R4 B
Incoming Outgoing Incoming Outgoing
Port Label Port Label Port Label Port Label
1 66 3 1 22 4
A to B A to B
Setup acknowledgement in a
virtual-circuit network A to B Legend
Incoming Outgoing Acknowledge packet
Network Port Label Port Label Virtual circuit
1 14 3
4 R1 R2
2
14 4
1
3
A R5 Network
3 66 66
1 2 2 2 3 1
22 77
3 22 1 4
R3 R4 77
B
Incoming Outgoing Incoming Outgoing
Port Label Port Label Port Label Port Label
1 66 3 1 22 4
A to B A to B
Flow of one packet in an established
virtual circuit
A to B Legend
Incoming Outgoing
A B Data Datagram
Port Label Port Label
Network 66 Virtual circuit
1 14 3
R1 R2
14 A B Data 2
1 4
A 3
66 A B Data R5 Network
12 2 3
22 A B Data 77 A B Data
3 1 4
R3 R4
Incoming Outgoing Incoming Outgoing
Port Label Port Label Port Label Port Label
1 66 3 22 1 22 4 77
A to B A to B
Virtual-circuit network- phases
Teardown phase
the source and destination inform the switches to
delete the corresponding entry.
Note
In virtual-circuit switching, all packets
belonging to the same source and
destination travel the same path;
but the packets may arrive at the
destination with different delays
if resource allocation is on demand.
Delay in Virtual Circuit
In a virtual-circuit network, there is a
one-time delay for setup and a one-
time delay for teardown.
If resources are allocated during the
setup phase, there is no wait time for
individual packets.
Delay in a virtual-circuit network
Not
e
Switching at the data link layer in a
switched WAN is normally
implemented by using
virtual-circuit techniques.
Efficiency
Resource reservation in a virtual-circuit network can be made
during the setup or can be on demand during the data-transfer
phase. In the first case, the delay for each packet is the same; in
the second case, each packet may encounter different delays.
There is one big advantage in a virtual-circuit network even if
resource allocation is on demand.
Delay
In a virtual-circuit network, there is a one-time delay for setup
and a one-time delay for teardown. If resources are allocated
during the setup phase, there is no wait time for individual
packets
Consider the following switch in VCI network and
answer
Comparison of Circuit Switching and Packet Switching
Parameter Circuit Switching Packet Switching
Routing scheme Route selected during call Each packet routed
setup independently
Multiplexing scheme Circuit multiplexing Packet multiplexing
shared media access
networks
Addressing scheme Hierarchical numbering plan Hierarchical address
space
Information Analog voice or PCM coded Binary information
representation voice
End terminal Telephone, modem Computer
Transmission system Analog and digital data over Digital data over
different transmission media different transmission
media
Traffic Real time interactive Heavy traffic
Application Telephone network for bi- Internet for datagram
directional, real time and reliable stream
COMPARISON OF DATAGRAM & VC SWITCHING
CIRCUIT SWITCHING VS VIRTUAL CIRCUIT
Circuit switching, on the other hand, guarantees a
consistent bit rate and latency. Still, with a virtual circuit
service, they may fluctuate owing to variables such as
variable packet queue lengths in network nodes, varying
application bit rates, fluctuating demand from other users
using the same network resources via statistical
multiplexing, and so on.
Virtual Circuit
Switch ports are numbered 0,1,2,3. Two paths
are drawn in, one from A to F in red and one
from B to D in green; Construct VCI Table at all
switches.
Virtual Circuit – VCI table Construction
A and F (shown above in red)
A and E
A and C
B and D (shown above in green)
A and F again (a separate connection)
Virtual Connections
A to F: A──4──S1──6──S2──4──S4──8──S5──5──F; this
path goes from S1 to S4 via S2
A to E: A──5──S1──6──S3──3──S4──8──E; this path goes,
for no particular reason, from S1 to S4 via S3, the opposite
corner of the square
A to C: A──6──S1──7──S3──3──C
B to D: B──4──S3──8──S1──7──S2──8──D
A to F: A──7──S1──8──S2──5──S4──9──S5──2──F
Switch S1
VCIin portin VCIout portout connectio
n
4 0 6 2 A⟶F #1
5 0 6 1 A⟶E
6 0 7 1 A⟶C
8 1 7 2 B⟶D
7 0 8 2 A⟶F #2
Switch S2
VCIin portin VCIout portout connectio
n
6 0 4 1 A⟶F #1
7 0 8 2 B⟶D
8 0 5 1 A⟶F #2
Switch S3
VCIin portin VCIout portout connectio
n
6 3 3 2 A⟶E
7 3 3 1 A⟶C
4 0 8 3 B⟶D
Switch S4
VCIin portin VCIout portout connectio
n
4 3 8 2 A⟶F #1
3 0 8 1 A⟶E
5 3 9 2 A⟶F #2
Switch S5 -
VCIin portin VCIout portout connectio
n
8 0 5 1 A to F
9 0 2 1 A to F
TRANSMISSION IMPAIRMENT
Signals travel through transmission media, which are not
perfect. The imperfection causes signal impairment. This
means that the signal at the beginning of the medium is
not the same as the signal at the end of the medium. What
is sent is not what is received. Three causes of impairment
are attenuation, distortion, and noise.
Topics discussed in this section:
Attenuation
Distortion
Noise
Causes of impairment
Attenuation
Means loss of energy -> weaker signal
When a signal travels through a medium it loses
energy overcoming the resistance of the medium
Amplifiers are used to compensate for this loss of
energy by amplifying the signal.
Measurement of
Attenuation
To show the loss or gain of energy the unit
“decibel” is used.
dB = 10log10P2/P1
P1 - input signal
P2 - output signal
Attenuation
Example
Suppose a signal travels through a transmission medium
and its power is reduced to one-half. This means that P 2 is
(1/2)P1. In this case, the attenuation (loss of power) can
be calculated as
Example
A signal travels through an amplifier, and its power is
increased 10 times. This means that P 2 = 10P1 . In this
case, the amplification (gain of power) can be calculated
as
Example
One reason that engineers use the decibel to measure the
changes in the strength of a signal is that decibel
numbers can be added (or subtracted) when we are
measuring several points (cascading) instead of just two.
In Figure 3.27 a signal travels from point 1 to point 4. In
this case, the decibel value can be calculated as
Decibels for Example 3.28
Example
Sometimes the decibel is used to measure signal power in
milliwatts. In this case, it is referred to as dBm and is
calculated as dBm = 10 log10 Pm , where Pm is the power in
milliwatts. Calculate the power of a signal with dB m =
−30.
Solution
We can calculate the power in the signal as
Example
The loss in a cable is usually defined in decibels per
kilometer (dB/km). If the signal at the beginning of a
cable with −0.3 dB/km has a power of 2 mW, what is the
power of the signal at 5 km?
Solution
The loss in the cable in decibels is 5 × (−0.3) = −1.5 dB.
We can calculate the power as
Example
A signal travels from point A to point B. At
point A, the signal power is 100 W. At point B,
the power is 90 W. What is the attenuation in
decibels?
Solution
dB = 10 log10 (90 / 100) = –0.46 dB
Distortion
Means that the signal changes its form or shape
Distortion occurs in composite signals
Each frequency component has its own
propagation speed traveling through a medium.
The different components therefore arrive with
different delays at the receiver.
That means that the signals have different
phases at the receiver than they did at the
source.
Distortion
Noise
There are different types of noise
Thermal - random noise of electrons in the wire
creates an extra signal
Induced - from motors and appliances, devices
act are transmitter antenna and medium as
receiving antenna.
Crosstalk - same as above but between two
wires.
Impulse - Spikes that result from power lines,
lighning, etc.
Noise
Signal to Noise Ratio (SNR)
To measure the quality of a system the SNR is
often used. It indicates the strength of the signal
wrt the noise power in the system.
It is the ratio between two powers.
It is usually given in dB and referred to as SNR dB.
Signal to Noise Ratio (SNR)
The signal-to-noise ratio is defined as
Because SNR is the ratio of two powers, it is often
described in decibel units, SNRdB, defined as
Example
The power of a signal is 10 mW and the power of the
noise is 1 μW; what are the values of SNR and SNR dB ?
Solution
The values of SNR and SNRdB can be calculated as
follows:
Two cases of SNR: a high SNR and a low SNR
DIGITAL SIGNALS
In addition to being represented by an analog signal,
information can also be represented by a digital signal.
For example, a 1 can be encoded as a positive voltage and
a 0 as zero voltage. A digital signal can have more than
two levels. In this case, we can send more than 1 bit for
each level.
Topics discussed in this section:
Bit Rate
Bit Length
Figure 3.16 Two digital signals: one with two signal levels and the other
with four signal levels
Example
A digital signal has eight levels. How many bits are
needed per level? We calculate the number of bits from
the formula
Each signal level is represented by 3 bits.
Example
Assume we need to download text documents at the rate
of 100 pages per sec. What is the required bit rate of the
channel?
Solution
A page is an average of 24 lines with 80 characters in
each line. If we assume that one character requires 8 bits
(ascii), the bit rate is
Example
What is the bit rate for each of the following signals?
a. A signal in which 1 bit lasts 0.001 s
b. A signal in which 1 bit lasts 2 ms
c. A signal in which 10 bits last 20 μs
Answer
bit rate = 1/ (bit duration)
a. bit rate = 1/ (bit duration) = 1 / (0.001 s) = 1000 bps = 1 Kbps
b. bit rate = 1/ (bit duration) = 1 / (2 ms) = 500 bps
c. bit rate = 1/(bit duration) = 1 / (20 μs/10) = 1 / (2 μs) = 500 Kbps
Example
A device is sending out data at the rate of 1000
bps.
a. How long does it take to send out 10 bits?
b. How long does it take to send out a single character (8
bits)?
c. How long does it take to send a file of 100,000
characters?
a.(10 / 1000) s = 0.01 s
b. (8 / 1000) s = 0. 008 s = 8 ms
c. ((100,000 × 8) / 1000) s = 800 s
Example
What is the bit rate for the signal
Solution
There are 8 bits in 16 ns.
Bit rate is = 8 / (16 × 10−9) = 0.5 × 10−9 = 500
Mbps
Example
A signal has passed through three cascaded
amplifiers, each with a 4 dB gain. What is the total
gain? How much is the signal amplified?
Solution
The total gain is 3 × 4 = 12 dB.
1.2
The signal is amplified by a factor 10 = 15.85
Example
A signal with 200 milliwatts power passes through
10 devices, each with an average noise of 2
microwatts. What is the SNR? What is the SNRdB?
Solution
SNR = (200 mW) / (10 × 2 × μW) = 10,000
DATA RATE LIMITS
A very important consideration in data communications is
how fast we can send data, in bits per second, over a
channel. Data rate depends on three factors:
1. The bandwidth available
2. The level of the signals we use
3. The quality of the channel (the level of noise)
Topics discussed in this section:
Noiseless Channel: Nyquist Bit Rate
Noisy Channel: Shannon Capacity
Using Both Limits
Note
Increasing the levels of a signal
increases the probability of an error
occurring, in other words it reduces the
reliability of the system. Why??
Capacity of a System
The bit rate of a system increases with an increase
in the number of signal levels we use to denote a
symbol.
A symbol can consist of a single bit or “n” bits.
The number of signal levels = 2n.
As the number of levels goes up, the spacing
between level decreases -> increasing the
probability of an error occurring in the presence of
transmission impairments.
Nyquist Theorem
Nyquist gives the upper bound for the bit rate of a
transmission system by calculating the bit rate
directly from the number of bits in a symbol (or
signal levels) and the bandwidth of the system
(assuming 2 symbols/per cycle and first harmonic).
Nyquist theorem states that for a noiseless channel:
C = 2 B log22n or C = 2 B log2L
C= capacity in bps
B = bandwidth in Hz
L = Signal levels
Example
Does the Nyquist theorem bit rate agree with the intuitive
bit rate described in baseband transmission?
Solution
They match when we have only two levels. We said, in
baseband transmission, the bit rate is 2 times the
bandwidth if we use only the first harmonic in the worst
case. However, the Nyquist formula is more general than
what we derived intuitively; it can be applied to baseband
transmission and modulation. Also, it can be applied
when we have two or more levels of signals.
Example
Consider a noiseless channel with a bandwidth of 3000
Hz transmitting a signal with two signal levels. The
maximum bit rate can be calculated as
Example
Consider the same noiseless channel transmitting a signal
with four signal levels (for each level, we send 2 bits). The
maximum bit rate can be calculated as
Example
We need to send 265 kbps over a noiseless channel with a
bandwidth of 20 kHz. How many signal levels do we
need?
Solution
We can use the Nyquist formula as shown:
Since this result is not a power of 2, we need to either
increase the number of levels or reduce the bit rate. If we
have 128 levels, the bit rate is 280 kbps. If we have 64
levels, the bit rate is 240 kbps.
Shannon’s Theorem
Shannon’s theorem gives the
capacity of a system in the
presence of noise.
C = B log2(1 + SNR)
Example
Consider an extremely noisy channel in which the value
of the signal-to-noise ratio is almost zero. In other words,
the noise is so strong that the signal is faint. For this
channel the capacity C is calculated as
This means that the capacity of this channel is zero
regardless of the bandwidth. In other words, we cannot
receive any data through this channel.
Example
We can calculate the theoretical highest bit rate of a
regular telephone line. A telephone line normally has a
bandwidth of 3000. The signal-to-noise ratio is usually
3162. For this channel the capacity is calculated as
This means that the highest bit rate for a telephone line is
34.860 kbps. If we want to send data faster than this, we
can either increase the bandwidth of the line or improve
the signal-to-noise ratio.
Example
The signal-to-noise ratio is often given in decibels.
Assume that SNRdB = 36 and the channel bandwidth is 2
MHz. The theoretical channel capacity can be calculated
as
Example
For practical purposes, when the SNR is very high, we
can assume that SNR + 1 is almost the same as SNR. In
these cases, the theoretical channel capacity can be
simplified to
For example, we can calculate the theoretical capacity of
the previous example as
Example
A line has a signal-to-noise ratio of
1000 and a bandwidth of 4000 KHz.
What is the maximum data rate
supported by this line?
Solution
Example
In practice, we need to use both methods to find the
limits and signal levels
We have a channel with a 1-MHz bandwidth. The SNR
for this channel is 63. What are the appropriate bit rate
and signal level?
Solution
First, we use the Shannon formula to find the upper limit.
Example (continued)
The Shannon formula gives us 6 Mbps, the upper limit.
For better performance we choose something lower, 4
Mbps, for example. Then we use the Nyquist formula to
find the number of signal levels.
Note
The Shannon capacity gives us the
upper limit; the Nyquist formula tells us
how many signal levels we need.
PERFORMANCE
One important issue in networking is the performance of
the network.
Topics discussed in this section:
Bandwidth - capacity of the system
Throughput - no. of bits that can be pushed through
Latency (Delay) - delay incurred by a bit from start to finish
Bandwidth-Delay Product
Note
In networking, we use the term
bandwidth in two contexts.
The first, bandwidth in hertz, refers to the
range of frequencies in a composite signal or
the range of frequencies that a channel can
pass.
The second, bandwidth in bits per second,
refers to the speed of bit transmission in a
channel or link. Often referred to as Capacity.
Bandwidth
Bandwidth in Hertz
Bandwidth in hertz is the range of frequencies
contained in a composite signal or the range of
frequencies a channel can pass.
Ex : the bandwidth of a subscriber telephone line is
4 kHz
Bandwidth in Bits per Seconds
refers to the number of bits per second that a
channel, a link, or even a network can transmit.
Ex - the bandwidth of a Fast Ethernet network (or
the links in this network) is a maximum of 100
Mbps. This means that this network can send 100
Mbps
Throughput
how fast we can actually send data through a
network
A link may have a bandwidth of B bps, but we can
only send T bps through this link with T always
less than B.
In other words, the bandwidth is a potential
measurement of a link; the throughput is an
actual measurement of how fast we can send
data.
Ex- a link with a bandwidth of 1 Mbps, but the
devices connected to the end of the link may
handle only 200 kbps.
This means that we cannot send more than 200
kbps through this link.
Example
A network with bandwidth of 10 Mbps can pass only an
average of 12,000 frames per minute with each frame
carrying an average of 10,000 bits. What is the
throughput of this network?
Solution
We can calculate the throughput as
The throughput is almost one-fifth of the bandwidth in
this case.
Latency (Delay)
The latency or delay defines how long it
takes for an entire message to completely
arrive at the destination from the time the
first bit is sent out from the source.
Latency = propagation time + transmission
time + queuing time + processing delay
Propagation Time & Transmission
Time
Propagation time
measures the time required for a bit to
travel from the source to the destination.
The propagation time is calculated by
dividing the distance by the propagation
speed.
Propagation time = Distance /
(Propagation Speed
Transmission Time
difference in arrival time of first and last
Propagation & Transmission delay
Propagation speed - speed at which a bit travels
though the medium from source to destination.
Transmission speed - the speed at which all the bits
in a message arrive at the destination. (difference in
arrival time of first and last bit)
Propagation and Transmission
Delay
Propagation Delay = Distance/Propagation speed
Transmission Delay = Message size/bandwidth bps
Latency = Propagation delay + Transmission delay
+ Queueing time + Processing time
Example
What is the propagation time if the distance between the two points
is 12,000 km? Assume the propagation speed to be
2.4 × 108 m/s in cable.
Solution
We can calculate the propagation time as
Propagation time = (12,000 x 1000) / (2.4 x 10 8 ) = 50 ms
The example shows that a bit can go over the Atlantic
Ocean in only 50 ms if there is a direct cable between the
source and the destination.
Example
What are the propagation time and the transmission time for a 2.5-
kbyte message (an e-mail) if the bandwidth of the network is 1
Gbps? Assume that the distance between the sender and the receiver
is 12,000 km and that light travels at 2.4 × 108 m/s.
Solution
Propagation time = (12,000 x 1000) / (2.4 x 10 8 ) = 50 ms
Transmission time = (2500 x 8) / 109 = 0.020 ms
Note that in this case, because the message is short and
the bandwidth is high, the dominant factor is the
propagation time, not the transmission time. The
transmission time can be ignored.
Example
What are the propagation time and the transmission time for
a 5-Mbyte message (an image) if the bandwidth of the
network is 1 Mbps? Assume that the distance between the
sender and the receiver is 12,000 km and that light travels at
2.4 × 108 m/s.
Solution
Propagation time = (12,000 x 1000) / (2.4 x 108 )=50 ms
Transmission time = (5000000 x 8) / 106 = 40s
Note that in this case, because the message is very long
and the bandwidth is not very high, the dominant factor is
the transmission time, not the propagation time. The
propagation time can be ignored.
Queuing Time
the time needed for each intermediate or end device to
hold the message before it can be processed.
The queuing time is not a fixed factor; it changes with the
load imposed on the network.
When there is heavy traffic on the network, the queuing
time increases.
An intermediate device, such as a router, queues the
arrived messages and processes them one by one. If there
are many messages, each message will have to wait.
Filling the link with bits in case 1
Filling the link with bits in case 2
Bandwidth-Delay Product
product of bandwidth and delay is the number of bits that
can fill the link.
we need to fill up the full-duplex channel (two directions)
The sender should send a burst of data of (2 × bandwidth ×
delay) bits.
The sender then waits for receiver acknowledgment for
part of the burst before sending another burst.
The amount 2 × bandwidth × delay is the number of bits
that can be in transition at any time
Example
We can think about the link between two points as a pipe.
The cross section of the pipe represents the bandwidth,
and the length of the pipe represents the delay. We can
say the volume of the pipe defines the bandwidth-delay
product, as shown in Figure
Note
The bandwidth-delay product defines the
number of bits that can fill the link.
Jitter
Another performance issue that is related to delay is
jitter.
if different packets of data encounter different
delays and the application using the data at the
receiver site is time-sensitive (audio and video data,
for example).
If the delay for the first packet is 20 ms, for the
second is 45 ms, and for the third is 40 ms, then the
real-time application that uses the packets endures
jitter
Example
If the bandwidth of the channel is 5 Kbps, how
long does it take to send a frame of 100,000 bits
out of this device?
Solution
Transmission Delay = Message size/bandwidth
bps
= 100000 / 5 x 103 = 20s
Example
A file contains 2 million bytes. How long does
it take to download this file using a 56-Kbps
channel? 1-Mbps channel?
Solution
• The file contains 2,000,000 × 8 = 16,000,000 bits.
• With a 56-Kbps channel, it takes 16,000,000/56,000 = 289 s.
• With a 1-Mbps channel, it takes 16 s.
Example
What is the transmission time of a packet sent
by a station if the length of the packet is 1
million bytes and the bandwidth of the channel
is 200 Kbps?
Solution
= 8,000,000 / 200 x 103 = 40s
Example
What is the total delay (latency) for a frame of
size 5 million bits that is being sent on a link
with 10 routers each having a queuing time of 2
μs and a processing time of 1 μs. The length of
the link is 2000 Km. The speed of light inside
the link is 2 × 108 m/s. The link has a bandwidth
of 5 Mbps. Which component of the total delay
is dominant? Which one is negligible?
Solution
Next slide
Example
Solution
Delay = Propagation delay + Transmission time + Queuing delay +
Processing delay
Propagation delay = distance / propagation speed = 2000*103 / 2*108 =
10 ms
Transmission time = frame size / Bandwidth = 5*106 / 5*106 = 1000 ms
Queuing delay = 10*0.002 ms = 0.02 ms
Processing delay = 10*0.001 ms = 0.01 ms
So, delay = 10 + 1000 + 0.02 + 0.01 = 1010.03 ms = 1.01003 seconds
Answer b
Transmission time (delay) is dominant in total delay.
Answer c
Queuing delay and processing delay are negligible.
Example
Practice
Solution
Solution
Example
How long does it take a packet of length 1,000
bytes to propagate over a link of distance 2,500 km,
propagation speed 2.5 x 108 m/s, and transmission
rate 2 Mbps? More generally, how long does it take
a packet of length L to propagate over a link of
distance d, propagation speed s, and transmission
rate R bps? Does this delay depend on packet
length? Does this delay depend on transmission
rate?
Example - solution
=>Packet length(L) = 1000 bytes
=>Propagation speed(s) = 2.5*10^8 m/s
=>Transmission rate(R) = 2 Mbps
=>Distance(d) = 2500 km
Explanation:
Calculating transmission delay(TT):
=>Transmission delay(TT) = packet length(L)/transmission rate(B)
=>Transmission delay(TT) = 1000 bytes/2 Mbps
=>Transmission delay(TT) = 1000*8 bits/2*10^6 bps
1 byte = 8 bits, 1 Mbps = 10^6 bps
=>Transmission delay(TT) = 4 ms
Example - solution
Calculating propagation delay:
=>Propagation delay(PT) = distance(d)/propagation speed(s)
=>Propagation delay(PT) = 2500 km/2.5*10^8 m/s
=>Propagation delay(PT) = 2500*1000 m/2.5*10^8 m/s
1 km = 1000 m
=>Propagation delay(PT) = 10 ms
Calculating total delay:
=>Total delay = transmission delay + propagation delay
=>Total delay = 4 ms + 10 ms
=>Total delay = 14 m
Here propagation time is more than transmission time. Hence, this delay
is not dependent on packet length and transmission rate.
Example
Suppose Host A wants to send a large file to Host B.
The path from Host A to Host B has three links, of
rates R1 = 500 kbps, R2 = 2 Mbps, and R3 = 1 Mbps.
a. Assuming no other traffic in the network, what is the
throughput for the file transfer?
b. Suppose the file is 4 million bytes. Dividing the file
size by the throughput, roughly how long will it take to
transfer the file to Host B?
c. Repeat (a) and (b), but now with R2 reduced to 100
kbps.
Example - solution
a)Consider given data:R1 = 500 kbps, R2 = 2 Mbps,
and R3 = 1 Mbps
The throughput for the file transfer=min{R1,R2,R3}
=min{500 kbps, 2 Mbps, 1 Mbps}
=500 kbps
So, the throughput for the file transfer=500 kbps
Example - solution
b)Consider given data:
The file size= 4 million bytes
Convert million bytes to bits
=32000000 bits.
From (a), Throughput for the file transfer=500 Kbps
=500000 bps
Dividing the file size by the throughput,roughly how long will it
take to transfer the file to Host B:
=file size/throughput for the file transfer
=32000000 bits/500000 bps
=64 seconds
Example - solution
Repeat (a) and (b), but now with R2 reduced to 100 kbps.
That means R2=100 kbps , R1 = 500 kbps, and R3 = 1 Mbps
The throughput for the file transfer=min{R1,R2,R3}
=min{500 kbps, 100 kbps, 1 Mbps} =100 kbps
So, the throughput for the file transfer=100 kbps
Dividing the file size by the throughput,roughly how long will
it take to transfer the file to Host B:
=file size/throughput for the file transfer
=32000000 bits/100000 bps
=320 seconds
COMPUTING THE ONE-HOP TRANSMISSION
DELAY
Consider the figure below, in which a single router is transmitting
packets, each of length L bits, over a single link with transmission
rate R Mbps to another router at the other end of the link. Suppose that
the packet length is L= 16000 bits, and that the link transmission rate
along the link to router on the right is R = 10 Mbps. What is the
transmission delay? What is the maximum number of packets per second
that can be transmitted by this link?
Solution
The transmission delay = L/R
= 16000 bits / 10000000 bps
= 0.0016 seconds
The number of packets that can be transmitted
in a second into the link
= R / L = 10000000 bps / 16000 bits
= 625 packets
COMPUTING END-END DELAY (TRANSMISSION AND
PROPAGATION DELAY)
Consider the figure below, with three links, each with the specified
transmission rate and link length. Assume the length of a packet is
12000 bits. The speed of light propagation delay on each link is
3x10^8 m/sec. Answer the following
Questions
1. What is the transmission delay of link 1?
2. What is the propogation delay of link 1?
3. What is the total delay of link 1?
4. What is the transmission delay of link 2?
5. What is the propogation delay of link 2?
6. What is the total delay of link 2?
7. What is the transmission delay of link 3?
8. What is the propogation delay of link 3?
9. What is the total delay of link 3?
10. What is the total delay?
Answers
Link 1 transmission delay = L/R = 12000 bits / 1000 Mbps = 1.20E-5 s
Link 1 propagation delay = d/s = ()3 Km) * 1000 / 3*10^8 m/sec =
1.00E-5 s
Link 1 total delay = d_t + d_p = 1.20E-5 s + 1.00E-5 s = 2.20E-5 s
Link 2 transmission delay = L/R = 12000 bits / 1 Mbps = 0.012 s
Link 2 propagation delay = d/s = ()500 Km) * 1000 / 3*10^8 m/s =
0.0017 s
Link 2 total delay = d_t + d_p = 0.012 s + 0.0017 s = 0.014 s
Link 3 transmission delay = L/R = 12000 bits / 10 Mbps = 0.0012 s
Link 3 propagation delay = d/s = ()2 Km) * 1000 / 3*10^8 m/sec =
6.67E-6 s
Link 3 total delay = d_t + d_p = 0.0012 s + 6.67E-6 s = 0.0012 s
Implementing Network Software
• Network architectures and protocol specifications are
essential things, but a good blueprint is not enough to
explain the phenomenal success of the Internet:
• some of the issues involved in implementing a network
application on top of the Internet , such programs are
simultaneously an application (i.e., designed to interact
with users) and a protocol (i.e., communicates with
peers across the network).
152
Implementing Network Software- Application
Programming Interface (Sockets)
• The place to start when implementing a network
application is the interface exported by the network.
• Since most network protocols are implemented in
software (especially those high in the protocol stack), and
nearly all computer systems implement their network
protocols as part of the operating system, when we refer
to the interface “exported by the network,” we are
generally referring to the interface that the OS provides
to its networking subsystem. This interface is often called
the network application programming interface (API).
153
Implementing Network Software- Application
Programming Interface (Sockets)
• The main abstraction of the socket interface, not
surprisingly, is the socket. A good way to think of a
socket is as the point where a local application process
attaches to the network.
• The interface defines operations for creating a socket,
attaching the socket to the network, sending/ receiving
messages through the socket, and closing the socket.
154
Implementing Network Software- Application
Programming Interface (Sockets)
• Socket creation Steps
• Step 1: create a socket, which is done with the
following operation:
int socket(int domain, int type, int protocol)
• Step 2 : depends on whether you are a client or a
server. On a server machine, the application process
performs a passive open theserver says that it is
prepared to accept connections, but it does not actually
establish a connection
155
Implementing Network Software- Application
Programming Interface (Sockets)
The server does this by invoking the following three
operations:
• int bind(int socket, struct sockaddr *address, int addr
len)
• int listen(int socket, int backlog)
• int accept(int socket, struct sockaddr *address, int
*addr len)
156
Implementing Network Software- Application
Programming Interface (Sockets)
On the client machine, the application process performs
an active open; that is, it says who it wants to
communicate with by invoking the following single
operation:
int connect(int socket, struct sockaddr *address, int addr
len)
157
Implementing Network Software- Application
Programming Interface (Sockets)
Once a connection is established, the application processes
invoke the following two operations to send and receive
data:
int send(int socket, char *message, int msg len, int flags)
int recv(int socket, char *buffer, int buf len, int flags)
The first operation sends the given message over the
specified socket, while the second operation receives a
message from the specified socket into the given buffer.
Both operations take a set of flags that control certain
details of the operation
158