Documente Academic
Documente Profesional
Documente Cultură
Le
ture 2
August 28, 2002
Please read le
ture notes immediately after ea
h
lass. They are here to help you better
digest the
lass, given that I usually talk pretty fast during
lass. They are not meant as a
substitute for
lass!
Remember to
ome to o
e hours! We want to get to know you.
As we said last time, the rst three le
tures are overview, after that, we'll slowly dene ea
h
pie
e of the network starting from the highest-level layer and working our way downwards.
Continuing with our overview ...
By
ontrast, in Cir
uit-Swit
hing networks, before Host A
an send the rst pa
ket to
Host B, a
onne
tion (
ir
uit) must be established between App. A and App. B. This
is one single path. Whenever Host A sends stu to Host B it will send it over this path.
Pa
kets don't need to
arry the address of Host B. Instead they just
arry their
ir
uit
identier. When App A is done, it tears down
onne
tion.
The above is the main dieren
e between Pa
ket-Swit
hing and Cir
uit-Swit
hing.
1
A5
A2
A1
A4
A3
A
A5
A4 A3
A2 A1
Loss o
urs when run out of room in router's buer. There are so many pa
kets
that want to go on some outgoing link that we don't have room to hold them in the outoing
buer for that link. We'd like to be able to temporarily in
rease the outgoing bandwidth
on the link (so as to get pa
kets out faster) or in
rease the buer length (so as to have room
to store extra pa
kets), but unfortunately these are nite xed quantities.
Answer:
Question:
Can loss be eliminated under Pa ket-swit hing? Under Cir uit-swit hing?
Cir
uit-Swit
hing
an
ontrol loss. Bandwidth and buer spa
e may be reserved for the
onne
tion at the time of
onne
tion setup.
Note, Cir
uit-Swit
hing doesn't have to mean that a link
an only be used by one
ir
uit.
A link may be shared by several
ir
uits. These are often
alled virtual
ir
uits. Ea
h
reserves a portion of bandwidth. Ea
h thinks that it is the only
ir
uit. The way in whi
h
ir
uits share a link under Cir
uit-swit
hing is to use TDM time-division multiplexing.
Time Division Multiplexing for
es the
ir
uits to take turns. Be
ause one of the big reasons
for doing Cir
uit-Swit
hing is to be able to make bandwidth reservations for the
onne
tion,
reservations are very often linked to denition of Cir
uit-Swit
hing. But this is not always
the
ase.
C
(a)
AC B A C B A C B A
(b)
Figure 3: (a) Shows link whose bandwidth is shared by 3 Virtual Cir
uits, A, B, and C,
ea
h re
eiving 1/3 of the bandwidth. (b) Shows how the taking turns a
tually happens, using
TDM, on a pa
ket-by-pa
ket basis.
Question:
Telephone. Denitely get your own
ir
uit and guaranteed bandwidth, so hear
well. ATM networks (we'll des
ribe these in detail later in
ourse).
Answer:
Question:
Answer:
Pa ket-Swit hed ... although not everyone is happy with that de ision.
Pa
ket-Swit
hing allows whi
hever pa
ket arrived rst to go rst, regardless of whi
h
ow
it
omes from. In Cir
uit-Swit
hing,
ows have spe
ied slots (turns), and you
an only
go on during your turn. This makes Cir
uit-Swit
hing ine
ient. Cir
uit-Swit
hing wastes
bandwidth if one
onne
tion has nothing to send during its turn, but another one does.
Example:
Suppose user A sends data over a link in following bursty manner: 1/10th of
the time A is a
tive generating data at 100 Kbps. 9/10th of the time A is sleeping. (We
an't
ontrol when the generating a
tivity is taking pla
e)
Question:
support?
Under Cir uit-Swit hing, if we have a 1Mbps link, how many su h users an we
10. And no delays for any of them, regardless of when ea
h user
hooses to
generate data.
Answer:
It turns out that under Pa
ket-Swit
hing, we
an usually support 30 users with almost no
delay (assuming the users are un
orrelated).
Question:
What's the probability that more than 10 (11 or more) users are a tive at on e?
Answer:
Pr f>
30
11
! 11
1
10
= :0005
Thus under Pa
ket-Swit
hing, even with 30 users, the probability that there will be a delay
is less than :0005.
Sin
e real
ows are in fa
t bursty, as in the above example, promoters of Pa
ket-Swit
hing
like to say that: \Pa
ket-Swit
hing almost always has similar delay performan
e to Cir
uitSwit
hing while allowing for 3x more users."
However the advantage of Cir
uit-Swit
hing wrt delay is that Cir
uit-Swit
hing
an provide
guaranteed upper bounds on delay (and guaranteed zero loss), whereas Pa
ket-Swit
hing
an not.
Question:
Answer:
le tures.
Give an example of an appli ation for whi h you'd want to use ir uits.
Anything where delay might be riti al. Audio tape. We'll dis uss this in later
Overhead omparison
With Cir
uit-Swit
hing, the sender has to wait until the
onne
tion has been established
before sending. With Pa
ket-Swit
hing,
ommuni
ation
an start immediately.
Routing Table
omparison
Routers
ontain information (usually in the form of a table) whi
h tell them where to
forward a pa
ket.
In the
ase of pa
ket-swit
hing, the pa
ket
arries with it the address of its destination host.
Ea
h router stores a table whi
h tells it to whi
h adja
ent router it should send the pa
ket
as a fun
tion of the datagram's destination address.
Next Router
Destination Address
128.2.6.15
R2
128.2.97.3
R4
132.3.4.15
R2
138.3.4.14
R2
whi h
But how is this done? Given a network with n nodes, there many be
exponentially-many dierent possible Virtual Cir
uits. If ea
h Virtual Cir
uit in the network
has a unique Virtual Cir
uit number, the Virtual Cir
uit number
ould be huge! We don't
want to
arry something so huge in our header.
Big Question:
There's a
tually a simple solution. I will des
ribe this during the se
ond half of
the
ourse. You
an try to gure it out yourself right now if you like. The point is that in
Cir
uit-Swit
hing you
an a
tually usually get away with mu
h smaller routing tables
than with pa
ket-swit
hing. This is why Cir
uit-Swit
hing is often touted for its speed.
Answer:
It's true that the total number of Virtual Cir
uits in the network may be huge.
However the number of Virtual Cir
uits passing through a single router is likely not big at
all.
Hint:
Remember that the Internet is Pa
ket-Swit
hed, not Cir
uit-Swit
hed.
To summarize, we in
lude here a summary
omparison of Cir
uit-Swit
hing vs. Pa
ketSwit
hing:
Pa
ket-Swit
hing:
No startup overhead for setting up
onne
tion, but per-pa
ket pro
essing overhead is
typi
ally higher than in Cir
uit-Swit
hing.
Routers are dumb (simple).
Every pa
ket
arries Virtual Cir
uit Identier header { pa
kets often
alled
ells
(ATM-speak).
Initial startup overhead for setting up
onne
tion, but very fast forwarding of pa
kets
thereafter. We'll see later in the
ourse that this is due to being able to get away with
a very short
ir
uit identier.
Routers maintain some state.
In Message-Swit
hing, whole message a
ts like a single pa
ket, not broken up.
Question:
What are the pros of message swit
hing over pa
ket swit
hing?
6
Message swit
hing skips overhead of unbundling and bundling. Re
all pa
ket
swit
hing must break message into pa
kets. Furthermore, in Pa
ket-Swit
hing, the pa
kets
mu
h ea
h
arry a destination header { overhead.
Answer:
Question:
Answer:
What are the ons of message swit hing over pa ket swit hing?
A little bit of history { the war between Pa
ket-Swit
hing and Cir
uitSwit
hing
In 1960's Telephone Network was the dominant
ommuni
ation network. It used
Cir
uit Swit
hing be
ause voi
e must be transmitted at a
onstant rate.
In 1967 ARPANET was started by the government resear
h agen
y ARPA. This was
the rst pa
ket-swit
hed network.
By 1972, ARPANET was up to a whopping 15 nodes.
During this time, various other pa
ket-swit
hed networks were introdu
ed. Also during this time Ethernet was introdu
ed as a te
hnology that worked well for small
distan
es.
In 1974 the notion of a \network of networks" was introdu
ed and people started talking about minimalism, best-eort servi
e, stateless routers, and de
entralized
ontrol.
During the 1980's ATM (a
ir
uit-swit
hing te
hnology) be
ame huge be
ause of its
speed and almost won out against the ARPANET. However, the ARPANET prevailed
and be
ame what we now
all the Internet.
A lot of the work on ARPANET was done via Computer S
ien
e departments, and
other networks like CSnet, that
onne
ted only CS departments.
In 1989 the Web was introdu
ed
In 1995 the US government transferred
ontrol of the Internet ba
kbone to private
arriers { all those ISPs and NBPs.
More re
ently delay-sensitive appli
ations (intera
tive-audio) have en
ouraged resear
hers to start thinking about how to make pa
ket-swit
hing more like
ir
uitswit
hing.
Today we have about 100 million ma
hines on the Internet.
Be
ause Pa
ket-swit
hing won the war, throughout most of the
ourse we will only talk
about pa
ket-swit
hing. However we will
ome ba
k to
ir
uit-swit
hing and spend a whole
le
ture on it about half-way through the
ourse (see s
hedule on
lass web page).
Motivation
10 minute wait before video starts. Allows for future delays of up to 10 minutes
in re
eiving pa
kets. If pa
ket arrived > 10 minutes late, it's just dropped.
Answer:
We'll have a detailed le
ture about multimedia over the Internet later in
lass.
Question:
So what does the Internet do about loss? Do we just live with it?
Answer: No. There's a proto
ol
alled TCP - Transmission Control Proto
ol whi
h
sits on top of the Pa
ket-Swit
hing layer and makes sure that there are no losses.
How do you think that TCP
an manage to enfor
e that there will be no loss,
given that it's running on top of IP, whi
h is a Pa
ket-Swit
hed layer?
Question:
Answer: TCP keeps tra
k of the pa
kets and when it dete
ts a loss it asks the IP layer to
resend the pa
ket.
Proto ols
En apsulation
Multiplexing/Demultiplexing
We will dis
uss ea
h of these aspe
ts of layering, while at the same time using as our example
the layering used in the Internet, a.k.a. the Internet Proto
ol Sta
k.
2.2
Remember our overall Goal: To get Appli
ation A at host H1 to intera
t in a meaningful
way (reliably) with Appli
ation B at host H2 over the network.
Layering is an approa
h used for building a network that
an do this.
Layering is the notion of relying on lower-layer servi
es as a bla
k box | just like we
do when we write
ode! (Fun
tion foo is dened in terms of a (simpler) fun
tion foobar.
Fun
tion foobar is dened in terms of a (simpler) fun
tion foobarbar. And so on, until we
get to the really basi
stu.
There are two advantages of layering (just like there are two advantages to using
abstra
tion in your
ode). What are these?
Question:
Answer:
In writing
ode, the reason my students give me for not wanting to use abstra
tion
is that, although
leaner, it makes the
ode a lot longer. Also sometimes a lot of arguments
need to be passed up from one level of abstra
tion to the next (from one fun
tion to the
next), and this wouldn't be ne
essary if you
ould just put all the
ode into one routine.
These are some of the same reasons why some people argue against layering. We'll dis
uss
this in more depth later in the
ourse.
Answer:
Suppose have
lient pro
ess on Host H1 talking to web server pro
ess on Host H2 (Appli
ation Layer). When the
lient wants to talk to the server, it writes into a so
ket { we'll
study these next le
ture. The
lient trusts that there is some implementation of so
kets
(Transport Layer) that takes the message from the
lient pro
ess to the server pro
ess. The
lient doesn't need to know anything about how this works. It's all a bla
k box to the
lient.
This type of abstra
tion happens at lower levels too. There is software that implements
these so
ket
alls, i.e., it allows one pro
ess to talk to another pro
ess (Transport Layer),
but that software assumes that the existen
e of a fun
tion whi
h
an send a pa
ket from
one host to another (far away) host (Network Layer). It doesn't know or
are how this lower
fun
tion is implemented. It just wants to use it as a bla
k box. Similarly, the fun
tion whi
h
an send a pa
ket from one host to another (far away) host (Network Layer), relies on a
lower-level fun
tion whi
h
an send a pa
ket from one router or host to a neighboring router
or host (Data Link Layer) (here neighbor is a little looser than you might be thinking), et
..
Network
ode is organized in this way. These dierent levels of abstra
tion are referred to
as layers. It is often said that ea
h layer \oers a servi
e" to the higher layer.
Every host and router in the Internet has 5 layers as shown below. Their organization is
similar to the above Qui
k Example.
Layer 5
Application
Layer 4
Transport
Layer 3
Network
Layer 2
Data Link
Layer 1
Physical
10
2.3
proto ols,
A proto
ol is an agreement between parties on how
ommuni
ation between the parties
should take pla
e. This in
ludes the language to be used in
ommuni
ation, how to take
turns in speaking, how to terminate the
onversation, et
..
We Ameri
ans have a proto
ol that says: when you see someone you know, you say \Hi,
how are you?" and then
ontinue walking without waiting for any answer. The other party
understands that they should reply with \Hi, how are you?" and also
ontinue walking
without waiting for any answer. Sin
e all parties understand this, it works quite well. If
someone were to deviate from the proto
ol, by a
tually answering the question, it would
ause problems.
In the same way Network proto
ols
an exist between
omputer programs or hardware
omponents.
As we said earlier, ea
h of the layers may be implemented by one of several proto
ols. Let's
dis
uss these proto
ols a bit.
In the Appli
ation Layer, there are many proto
ols available to us. For example, HTTP,
whi
h denes the exa
t language that a Client's Browser pro
ess should use when speaking
to a Web server pro
ess. Another example, ftp, is a proto
ol whi
h transfers les from
one host to another host. SMTP is the Simple Mail Transfer Proto
ol whi
h is used in
ommuni
ating between your mail pro
ess (elm or pine) and a mail server whi
h houses
your mail.
In the Transport Layer there are also many proto
ols available to us. The most popular
are TCP { Transport Control Proto
ol and UDP { User Datagram Proto
ol.
is
onsidered a bare-bones minimal transport layer. All it does is the bare-minimum
fun
tion required by a transport layer { i.e. it provides a way for a pro
ess on ma
hine A
to talk to a pro
ess on ma
hine B, while making use of the power of the network layer to
send pa
kets from ma
hine A to ma
hine B. Remember that the network layer may send
these pa
kets out of order, may lose pa
kets, et
.. UDP does not
orre
t for this. It only
makes sure that whi
hever of the pa
kets arrive, end up being dire
ted to pro
ess B.
UDP
TCP
11
Question:
than UDP?
You might be thinking, why not always use TCP, sin e it does so mu h more
TCP has a high overhead, whi
h means it adds a lot of delay, and also variability
in delay. Many appli
ations therefore prefer to run on top of UDP. For example your video
server might prefer to use UDP, sin
e loss is not so
ru
ial and variability in delay is
ru
ial.
However your mail server will denitely run on top of TCP, sin
e it's important that none
of those pa
kets of mail get lost.
Answer:
For the Network Layer there is only one proto
ol. This is IP { the Internet Proto
ol,
whose job it is to forward pa
kets from one host to another in a Pa
ket-Swit
hed manner.
Most of what we study in this
ourse will be proto
ols, so I won't belabor it further now.
The proto
ol at a given layer denes two things:
First, for the given layer i, the proto
ol at layer i denes the interfa
e/language/syntax
that layer i + 1 will use to a
ess the \servi
e" that layer i provides. For example, there
are dierent transport level proto
ols (e.g., TCP and UDP). These would ea
h provide
a dierent so
ket interfa
e to the Appli
ation level. I think of this as master-to-slave
ommuni
ation.
Se
ondly, the proto
ol denes a language/order by whi
h \peer" layers
an talk to ea
h other
on dierent ma
hines. Realize that ea
h ma
hine has this whole sta
k of layers implemented.
When an appli
ation running on Host H1
ommuni
ates with an appli
ation running on
Host H2, then the transport proto
ol on H1 will \indire
tly" be
ommuni
ating with the
same transport proto
ol on H2. Likewise the network proto
ol on H1 will \indire
tly" be
ommuni
ating with the network proto
ol on H2, et
.. To understand what we mean by
this peer-to-peer
ommuni
ation, we need to turn to the notion of en
apsulation.
2.4
Consider a Client Appli
ation on host H1 whi
h wants to send a message to a Web Server
Appli
ation on host H2. The Client's message is written in the \language" HTTP (a
proto
ol). The Client appli
ation writes its message into a so
ket and then TCP (the
transport proto
ol) magi
ally takes the message to the so
ket on the server where the
transport proto
ol on the server then hands the message up to the Server appli
ation (the
server reads from its so
ket).
Let's look at how TCP a
hieves its fun
tions. First, TCP has to make sure to get the
message to the right pro
ess on the target host (the server). TCP is passed the appropriate
information about the target pro
ess from the Appli
ation layer via the so
ket
all (we'll
see this next
lass). However it needs to make sure that when the message gets to the target
12
Application
Application
Transport
Transport
Network
Network
Link
Link
Physical
Physical
M1
TH M2
NH TH M1
NH TH M2
LH NH TH M1
LH NH TH M1
TH
Source
Figure 7: Illustration of how message M is divided into 2 segments (pa
kets) M1 and M2.
Headers are then added to both M1 and M2. Headers get added all the way down the
sour
e's sta
k. Headers get stripped all the way up the destination's sta
k (just reverse the
arrows). The header added last at the sour
e will (
onveniently) be the rst to be stripped
at the destination. TH { Transport layer header above at the very least
ontains the
destination pro
ess. NH { Network layer header above at the very least
ontains the
destination IP address. LH { Link layer header above at the very least
ontains the
neighbor address (MAC address).
14
2.5
There's only one implementation for the network layer. That's IP, the Internet Proto
ol.
However, there are multiple implementations of the other layers. For example there are two
transport layers: TCP and UDP. If the sour
e uses a parti
ular implementation (for example
the sour
e host uses the TCP proto
ol at the transport layer) then it would like to
onvey
to the destination host that it too should use the TCP proto
ol when interpreting the
information.
How do you think the sour
e host
onveys to the destination host that it's using
TCP (as opposed to UDP or some other transport proto
ol)?
Question:
The sour
e host does this by spe
ifying \TCP" in the network-layer pa
ket
header. When the network-layer pa
ket header is stripped on the target host, the target
host's network layer sees the TCP and knows to pass the segment up to its TCP proto
ol,
rather than its UDP proto
ol.
Answer:
The transport proto
ol does the same kind of thing when it embeds the destination pro
ess
into its transport-layer header, so that the target host's transport proto
ol knows whi
h
pro
ess to pass the message to in the appli
ation layer.
This form of multiplexing at the sour
e and
ea
h layer of the proto
ol sta
k.
2.6
demultiplexing
Qui k Test
layer?
What's the dieren e between the transport layer and the network
The network layer provides
ommuni
ation between two hosts. The transport
layer provides
ommuni
ation between two pro
esses.
Answer:
Re
all the Internet Proto
ol sta
k. Re
all that ea
h layer relies on the servi
es of the layer
below it. Re
all how pa
kets are en
apsulated with header information for ea
h layer, and
later those headers are stripped. As we go through this
ourse, we will have a mu
h better
understanding of what goes in the headers. Hint: Adding and stripping headers is one of
Consider Figure 8 below showing the order of how layers are added and removed. Point:
Application
Application
TH M
Transport
Transport
TH M
NH TH M
Network
Network
NH TH M
Link
Link
Physical
Physical
LH NH TH M
PH LH NH TH M
LH NH TH M
PH LH NH TH M
Usually: Hubs only speak layer 1 { they are just a repeater of the signal. Bridges
only implement 2 layers. They don't speak IP. They don't know about IP addresses. Routers
implement 3 layers, as shown in Figure 9 below.
Answer:
Application
Application
TCP
TCP
Network
Data Link
Wires
Host
Data Link
Network
Network
Data Link
Data Link
Wires
Wires
Wires
Bridge
Router
Host
16