0% found this document useful (0 votes)
76 views

CS244a: An Introduction To Computer Networks: Handout 3: Foundations and Basic Concepts

This document provides an overview of the key concepts in computer networks through examples and definitions. It uses a detailed file transfer protocol example to illustrate how data moves between layers from the application down to the physical layer and back up as it travels from source to destination across multiple routers. It defines concepts like circuit switching, which establishes dedicated paths, and packet switching, used by the internet, where packets are routed individually. It also covers statistical multiplexing, propagation delay, transmission time, bandwidth, and how breaking messages into packets allows more efficient use of network resources.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

CS244a: An Introduction To Computer Networks: Handout 3: Foundations and Basic Concepts

This document provides an overview of the key concepts in computer networks through examples and definitions. It uses a detailed file transfer protocol example to illustrate how data moves between layers from the application down to the physical layer and back up as it travels from source to destination across multiple routers. It defines concepts like circuit switching, which establishes dedicated paths, and packet switching, used by the internet, where packets are routed individually. It also covers statistical multiplexing, propagation delay, transmission time, bandwidth, and how breaking messages into packets allows more efficient use of network resources.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

CS244a: An Introduction to Computer Networks

Handout 3: Foundations and Basic Concepts


Nick McKeown

Professor of Electrical Engineering and Computer Science, Stanford University


[email protected] http://www.stanford.edu/~nickm

Winter 2008

CS244a Handout 3

Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3

Winter 2008

Example: FTP over the Internet Using TCP/IP and Ethernet 1 App A Stanford B (MIT) 20 App

2 3 OS 4
Ethernet

19 18 OS 17 14 R5 5 R1 15 R5 R1 6 8 11 7 9 R2 R3 R2 R3 12 16 13 10 R4 R4
CS244a Handout 3
Ethernet

Winter 2008

In the sending host


1. 2.

Application-Programming Interface (API)

Transmission Control Protocol (TCP)


Creates TCP Connection setup packet TCP requests IP packet to be sent to B TCP Packet
TCP Data TCP Header
Empty CS244a Handout 3

Application requests TCP connection with B

Type = Connection Setup

Winter 2008

In the sending host (2)


3. Internet Protocol (IP)
TCP Packet
TCP Data

Creates IP packet with correct addresses. IP requests packet to be sent to router.


TCP Header Destination Address: IP B IP Source Address: IP A Header Protocol = TCP

Encapsulation

IP Packet
Winter 2008

IP Data

CS244a Handout 3

In the sending host (3)


4. Link (MAC or Ethernet) Protocol
IP Packet
IP Data

Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
IP Header

Encapsulation

Ethernet FCS

Ethernet Data

Ethernet Header

Ethernet Packet
Winter 2008

Destination Address: MAC R1 Source Address: MAC A Protocol = IP

CS244a Handout 3

In Router R1
5. Link (MAC or Ethernet) Protocol
IP Packet
IP Data

Accept MAC frame, check address and Frame Check Sequence (FCS). Pass data to IP Protocol.
IP Header

Decapsulation

Ethernet FCS

Ethernet Data

Ethernet Header

Ethernet Packet
Winter 2008

Destination Address: MAC R1 Source Address: MAC A Protocol = IP

CS244a Handout 3

In Router R1
6. Internet Protocol (IP)
Use IP destination address to decide where to send packet next (next-hop routing). Request Link Protocol to transmit packet. IP Data IP Header
Destination Address: IP B
Source Address: IP A Protocol = TCP

IP Packet

Winter 2008

CS244a Handout 3

In Router R1
7. Link (MAC or Ethernet) Protocol
IP Packet
IP Data

Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
IP Header

Encapsulation

Ethernet FCS

Ethernet Data

Ethernet Header

Ethernet Packet
Winter 2008

Destination Address: MAC R2 Source Address: MAC R1 Protocol = IP

CS244a Handout 3

In Router R5
16. Link (MAC or Ethernet) Protocol
IP Packet
IP Data IP Header

Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.

Encapsulation

Ethernet FCS

Ethernet Data

Ethernet Header

Ethernet Packet
Winter 2008

Destination Address: MAC B Source Address: MAC R5 Protocol = IP

CS244a Handout 3

10

In the receiving host


17. Link (MAC or Ethernet) Protocol
IP Packet
IP Data

Accept MAC frame, check address and Frame Check Sequence (FCS). Pass data to IP Protocol.
IP Header

Decapsulation

Ethernet FCS

Ethernet Data

Ethernet Header

Ethernet Packet
Winter 2008

Destination Address: MAC B Source Address: MAC R5 Protocol = IP

CS244a Handout 3

11

In the receiving host (2)


18. Internet Protocol (IP)
TCP Packet
TCP Data

Verify IP address. Extract/decapsulate TCP packet from IP packet. Pass TCP packet to TCP Protocol.
TCP Header Destination Address: IP B IP Source Address: IP A Header Protocol = TCP

Decapsulation

IP Packet
Winter 2008

IP Data

CS244a Handout 3

12

In the receiving host (3)


19. Transmission Control Protocol (TCP)
20. Application-Programming Interface (API)
TCP Packet
Accepts TCP Connection setup packet Establishes connection by sending Ack. Application receives request for TCP connection with A.

TCP Data
Winter 2008

TCP Header

Type = Connection Setup

Empty CS244a Handout 3

13

Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3

Winter 2008

14

Layering: The OSI Model


7 Application 5 Session
layer-to-layer communication

Presentation 6
4 Transport 3 Network

Link 1 Physical
2

Network Link Physical

Router

Peer-layer communication

Network Link Physical


CS244a Handout 3

Router

Application 7 Presentation6 Session 5 Transport 4 Network 3 Link 2 Physical 1


15

Winter 2008

Layering: Our FTP Example


Application Presentation Session Transport Network Link Physical
Winter 2008
FTP ASCII/Binary TCP IP Ethernet

Application Transport Network Link

The 7-layer OSI Model

The 4-layer Internet model


CS244a Handout 3 16

Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3

Winter 2008

17

Circuit Switching
A Source B Destination

Its the method used by the telephone network. A call has three phases:
1. Establish circuit from end-to-end (dialing), 2. Communicate, 3. Close circuit (tear down).

Originally, a circuit was an end-to-end physical wire. Nowadays, a circuit is like a virtual private wire: each call has its own private, guaranteed data rate from end-to-end.
Winter 2008 CS244a Handout 3 18

Circuit Switching
Each phone call is allocated 64kb/s. So, a 2.5Gb/s trunk line can carry about 39,000 calls.

Telephone Network

Source Caller Central Office C.O. Trunk Exchange Central Office C.O.

Destination Callee

Winter 2008

CS244a Handout 3

19

Packet Switching
A Source
R2 R1 R4 R3

B Destination

Its the method used by the Internet. Each packet is individually routed packet-by-packet, using the routers local routing table. The routers maintain no per-flow state. Different packets may take different paths. Several packets may arrive for the same output link at the same time, therefore a packet switch has buffers.
Winter 2008 CS244a Handout 3 20

10

Packet Switching
Simple router model
4
Link 2 Link 1, ingress

Choose Egress Choose Egress Choose Egress Choose Egress

Link 1, egress

Link 1

R14
Link 4

Link 2, ingress Link 3

Link 2, egress

Link 3, ingress

Link 3, egress

Link 4, ingress

Link 4, egress

Winter 2008

CS244a Handout 3

21

Statistical Multiplexing
rate

One flow

Basic idea Two flows


rate Average rate

time

Network traffic is bursty. i.e. the rate changes frequently. Peaks from independent flows generally occur at different times. Conclusion: The more flows we have, the smoother the traffic. Winter 2008 CS244a Handout 3

time

rate

Many flows
Average rates of: 1, 2, 10, 100, 1000 flows.
time

22

11

Packet Switching
Statistical Multiplexing
Queue Length X(t)

Packets for one output


1 2

Data Hdr Data Hdr Data Hdr

Dropped packets

R R R

X(t)

Link rate, R

Packet buffer

Time

Because the buffer absorbs temporary bursts, the egress link need not operate at rate N.R. But the buffer has finite size, B, so losses will occur.
Winter 2008 CS244a Handout 3 23

Statistical Multiplexing
Rate A
C A C

time Rate B
C

time
Winter 2008 CS244a Handout 3 24

12

Statistical Multiplexing Gain


Rate A+B
2C R < 2C A B R

Statistical multiplexing gain = 2C/R


Other definitions of SMG: The ratio of rates that give rise to a
particular queue occupancy, or particular loss probability.
CS244a Handout 3 Winter 2008 25

time

Why does the Internet use packet switching?


1. Efficient use of expensive links:
The links are assumed to be expensive and scarce. Packet switching allows many, bursty flows to share the same link efficiently. Circuit switching is rarely used for data networks, ... because of very inefficient use of the links - Gallager

2. Resilience to failure of links & routers:

For high reliability, ... [the Internet] was to be a datagram subnet, so if some lines and [routers] were destroyed, messages could be ... rerouted - Tanenbaum
CS244a Handout 3 26

Winter 2008

13

Some Definitions
Packet length, P, is the length of a packet in bits. Link length, L, is the length of a link in meters. Data rate, R, is the rate at which bits can be sent, in bits/second, or b/s.1 Propagation delay, PROP, is the time for one bit to travel along a link of length, L. PROP = L/c. Transmission time, TRANSP, is the time to transmit a packet of length P. TRANSP = P/R. Latency is the time from when the first bit begins transmission, until the last bit has been received. On a link:
Latency = PROP + TRANSP.

Winter 2008

1. Note that a kilobit/second, kb/s, is 1000 bits/second, not 1024 bits/second.

CS244a Handout 3

27

Packet Switching
A Source
R2 R1 R4 R3

B Destination

Host A
R1 R2 R3

TRANSP1 TRANSP2
PROP1

Store-and-Forward at each Router

TRANSP3
PROP2

TRANSP4
PROP3

Minimum end to end latency = (TRANSP + PROP )


PROP4

Host B

Winter 2008

CS244a Handout 3

28

14

Packet Switching Why not send the entire message in one packet?
M/R M/R

Host A
R1 R2 R3

Host B

Latency =

(PROP + M / R )
i i i

Host A R1 R2 R3 Host B

Latency = M / Rmin +

PROP
i

Breaking message into packets allows parallel transmission across all links, reducing end to end latency. It also prevents a link from being hogged for a long time by one message.
Winter 2008 CS244a Handout 3 29

Because the egress link is not necessarily free when a packet arrives, it may be queued in a buffer. If the network is busy, packets might have to wait a long time.

Packet Switching Queueing Delay


TRANSP1 Q2 TRANSP2
PROP1

Host A
R1 R2 R3

TRANSP3
PROP2

TRANSP4
PROP3

How can we determine the queueing delay?


i i i

Host B Actual end to end latency = (TRANSP + PROP + Q )


PROP4

Winter 2008

CS244a Handout 3

30

15

To understand the performance of a packet switched network, we can think of it as a series of queues interconnected by links. For given link rates and lengths, the only variable is the queueing delay. If we can understand the queueing delay, we can understand how the network performs.

Queues and Queueing Delay

Winter 2008

CS244a Handout 3

31

Queues and Queueing Delay

Cross traffic causes congestion and variable queueing delay.


Winter 2008 CS244a Handout 3 32

16

A router queue
Model of FIFO router queue
A(t),

D(t)

Q(t)

The arrival process. The number of arrivals in interval [0, t ]. : The average rate of new arrivals in packets/second. D(t ) : The departure process. The number of departures in interval [0, t ]. 1 : The average time to service each packet.
A(t ) : Q(t ): The number

of packets in the queue at time t.


CS244a Handout 3

Winter 2008

33

A simple deterministic model


Model of FIFO router queue
A(t),

D(t)

Q(t)

Properties of A(t), D(t): A(t), D(t) are non-decreasing


A(t) >= D(t)

Winter 2008

CS244a Handout 3

34

17

A simple deterministic model


bytes or fluid
Cumulative number of bits

Cumulative number of bits that arrived up until time t.

A(t) D(t)

A (t )

Q(t)
Service process

D(t)

time

Cumulative number of departed bits up until time t.

Properties of A(t), D(t): A(t), D(t) are non-decreasing


A(t) >= D(t)

Winter 2008

CS244a Handout 3

35

Simple deterministic model


Cumulative number of bits
A(t) Q(t) d(t)

D(t)

Queue occupancy: Q(t) = A(t) - D(t).

time

Queueing delay, d(t), is the time spent in the queue by a bit that arrived at time t, and if the queue is served first-come-first-served (FCFS or FIFO)
Winter 2008 CS244a Handout 3 36

18

Cumulative number of bits

Example
Q(t) d(t)

100

A(t)

D(t)

Example: Every second, a train of 100 bits arrive at rate 1000b/s. The maximum departure rate is 500b/s. What is the average queue occupancy?

Solution: During each cycle, the queue fills at rate 500b/s for 0.1s, then drains at rate 500b/s for 0.1s.The average queue occupancy when the queue is non-empty is therefore: (Q(t ) Q(t ) > 0) = 0.5 (0.1 500) = 25 bits. The queue is empty for 0.8s each cycle, and so: Q(t ) = (0.2 25) + (0.8 0) = 5 bits. (You'll probably have to think about this for a while...).

0.1s

0.2s

1.0s

time

Winter 2008

CS244a Handout 3

37

1.

2.

3.

Usually, arrival processes are complicated, so we often model them as random processes. The study of queues with random arrival processes is called Queueing Theory. Queues with random arrival processes have some interesting properties. Well consider some here.
CS244a Handout 3 38

Queues with Random Arrival Processes

Winter 2008

19

Properties of queues
Time evolution of queues. Examples Littles Result. The M/M/1 queue.
Burstiness increases delay Determinism minimizes delay

Winter 2008

CS244a Handout 3

39

Time evolution of a queue


Packets

Model of FIFO router queue


A(t), D(t)

Q(t)
Packet Arrivals: Departures:
1

time

Q(t)

Winter 2008

CS244a Handout 3

40

20

Burstiness increases delay


Example 1: Periodic arrivals 1 packet arrives every 1 second 1 packet can depart every 1 second Depending on when we sample the queue, it will contain 0 or 1 packets. Example 2: N packets arrive together every N seconds (same rate) 1 packet departs every second Queue might contain 0,1, , N packets. Both the average queue occupancy and the variance have increased. In general, burstiness increases queue occupancy (which increases queueing delay).
CS244a Handout 3

Winter 2008

41

Determinism minimizes delay


Example 3: Random arrivals
Packets arrive randomly; on average, 1 packet arrives per second. Exactly 1 packet can depart every 1 second. Depending on when we sample the queue, it will contain 0, 1, 2, packets depending on the distribution of the arrivals.

In general, determinism minimizes delay. random arrival processes lead to larger delay than simple periodic arrival processes.
i.e.

Winter 2008

CS244a Handout 3

42

21

Littles Result
L = d

Winter 2008

Where: L is the average number of customers in the system (the number in the queue + the number in service), is the arrival rate, in customers per second, and d is the average time that a customer waits in the system (time in queue + time in service). Result holds so long as no customers are lost/dropped.
CS244a Handout 3

43

The Poisson process


Poisson process is a simple arrival process in which: 1. Probability of k arrivals in an interval of t seconds is:
(t )k t e k! 2. The expected number of arrivals in interval t is: t. Pk (t ) =

3. Successive interarrival times are independent of each other (i.e. arrivals are not bursty).

Winter 2008

CS244a Handout 3

44

22

The Poisson process


Why use the Poisson process? It is the continuous time equivalent of a series of coin tosses. The Poisson process is known to model well systems in which a large number of independent events are aggregated together. e.g.

It makes the math easy. Be warned Network traffic is very bursty! Packet arrivals are not Poisson. But it models quite well the arrival of new flows.
Winter 2008 CS244a Handout 3 45

Arrival of new phone calls to a telephone switch Decay of nuclear particles Shot noise in an electrical circuit

An M/M/1 queue
Model of FIFO router queue
A(t),

D(t)

If A(t) is a Poisson process with rate , and the time to serve each packet is exponentially distributed with rate , then:

Average delay, d =
Winter 2008

1 ;

and so from Little's Result: L = d =


CS244a Handout 3

46

23

You might also like