Professional Documents
Culture Documents
CS6551 Chapter 1
CS6551 Chapter 1
Chapter 1
Foundation
2
Chapter 1
Chapter Outline
Applications
Requirements
Network Architecture
Implementing Network Software
Performance
3
Chapter 1
Chapter Goal
Exploring the requirements that different
applications and different communities place on
the computer network
Introducing the idea of network architecture
Introducing some key elements in implementing
Network Software
Define key metrics that will be used to evaluate
the performance of computer network
4
Chapter 1
Applications
Most people know about the Internet (a
computer network) through applications
World Wide Web
Just a single application of the Internet
Email
Online Social Network
Streaming Audio Video
File Sharing
Instant Messaging
…
5
Chapter 1
Application Protocol (WWW)
URL
Uniform resource locater
http://www.just.edu.jo/~misaleh/Teaching/cs342spring2011/main
page.html
www.just.edu.jo is the name of the machine that serves the page
IP: 87.236.232.169
nslookup
whois
/~misaleh/Teaching/cs342/mainpage.html uniquely identifies the
required page
6
Chapter 1
Application Protocol (Cont.)
HTTP
Hyper Text Transfer Protocol
TCP
Transmission Control Protocol
17 messages for one URL request
6 to find the IP (Internet Protocol) address
3 for connection establishment of TCP
4 for HTTP (GET) request and acknowledgement (Response)
Request: I got your request and I will send the data
Reply: Here is the data you requested; I got the data
4 messages for tearing down TCP connection
7
Chapter 1
Example of an application
8
Chapter 1
Expectations!!
HTML requests:
A couple of seconds delay is acceptable
Pages are complete
Images can be delivered out of order
Etc…
Emails:
No missing parts (i.e., the email is identical to what you sent)
A minute or two delay is acceptable
Etc…
Video conferencing:
Video and sound MUST be continuous and on a timely matter
Some missing parts are acceptable
9
Chapter 1
Requirements
Application Programmer
List the services that his application needs: delay
bounded delivery of data
Network Designer
Design a cost-effective network with sharable
resources
Network Provider (usually called Service
Provider, for the Inernet, it ISP)
List the characteristics of a system that is easy to
administer and manage.
Add new clients and remove/isolate faulty nodes
10
Chapter 1
Requirements
Connectivity
Cost-Effective Resource Sharing
Support for Common Services
Reliability
Manageability
11
Chapter 1
Connectivity
Need to understand the following terminologies
Scale: A system that is designed to support growth to an
arbitrarily large size
Link: Physical medium that connects nodes
Node: a device (could be a computer, switch, etc) on the network
Point-to-point: direct link between two nodes
Multiple access: multiple nodes share the same link
(a) Point-to-point
(b) Multiple access
12
Chapter 1
Connectivity
Switched Network: a network that uses switches for
forwarding
Circuit Switched
Telephone companies
Dedicated/reserved when connection is established
Less utilization of the resources
Packet Switched
Overwhelming majority of computer networks
Messages are divided into pieces (discrete blocks) called packets
No dedication is required
More sharing, thus more utilization
Store-and-forward: a switch stores the incoming traffic
(packets) in its own buffers then forwards them.
13
Chapter 1
Connectivity
Cloud: used to represent any kind of network technology
Point-to-point, multiple-access, or switched network
14
Chapter 1
Connectivity
Router/gateway: connects two or more networks (plays
much the same role as a switch—stores and forwards)
(a) (b)
16
Chapter 1
Cost-Effective Resource Sharing
Resource: links and
nodes
How to share a link?
Multiplexing
Analogy to a timesharing
computer system
De-multiplexing
Synchronous Time-division
Multiplexing (STDM)
Equal-sized quanta
Multiplexing multiple logical flows
Round-robin fashion
over a single physical link
Time slots/data
transmitted in
predetermined slots
17
Chapter 1
Cost-Effective Resource Sharing
FDM: Frequency Division Multiplexing
Diff. TV stations with diff. frequencies.
Both STDM and FDM waste resources and hard to
accommodate changes (fixed time slots and frequencies)
Statistical Multiplexing
Like STDM: sharing over time but data is
transmitted based on demand rather than
during a predetermined time slot
18
Chapter 1
Statistical Multiplexing
Packets vs. Messages
Fair decision: FIFO,
Round-Robin, Priorities
(Quality-of-Service (QoS)
allocate bandwidth for a
particular flows)
19
Chapter 1
LAN, MAN, WAN, and SAN
Characterize networks according to their
size (they usually use diff. technologies):
LAN: Local Area Network, typically less than
1km
WAN: Wide Area Network, worldwide
MAN: Metropolitan Area Network, tens of
kilometers
SAN: Systems/Storage Area Network, single
room that has high-performance components
(like leading-edge storage devices) connected
together
20
Chapter 1
Support for Common Services
Overly simplistic to think about network as
simple delivering packets among a collection of
computers
But rather a means for application processes to
communicate
21
Chapter 1
Support for Common Services
One option would be for the app designers
to build all that complicated functionality
into each application.
However, since many applications need
common services, it is much more logical
to build those common services once and
let the app designers to use the services.
22
Chapter 1
Support for Common Services
23
Chapter 1
Support for Common Services
The challenge then is recognize what
functionality the channel should provide to
application programs:
Reliable delivery?!
Same order?!
Eavesdropping parties?!
In general, a network provides a variety of
different types of channels
An applications can choose the best that
meets its needs
24
Chapter 1
Common Communication Patterns
Designing abstract channels involve
Understanding representative collection of apps
Extract the common needs
Client/Server
FTP (file transfer protocol), NFS (network file system),
digital libraries like ACM
Video conferencing
Two-way traffic (or one-way with video on demand)
No need to guarantee the delivery of ALL messages.
Same order is required
Might need multicast
25
Chapter 1
Common Communication Patterns
Two types of common communication channels
Request/Reply Channels
Message Stream Channels
It is dangerous to have too much abstractions
Every application has to choose between the provided channels
If you have a hammer then you might see everything looks like a
nail,
Independent of exactly what functionality a given
channel should provide is where this functionality should
be implemented.
On switches => dump hosts, like the telephone handsets
On hosts => keep switches as simple as possible
26
Chapter 1
Reliability
Network should hide the errors
Bits are lost
Bit errors (1 to a 0, and vice versa)
Burst errors – several consecutive errors
Outside forces like: lightning strikes, microwave
ovens, etc.
Packets are lost (Congestion)
Links and Node failures (crashes and misconfig.)
Messages are delayed
Messages are delivered out-of-order
Third parties eavesdrop
27
Chapter 1
Manageability
Last requirement that is usually neglected
Making changes as the network grows to
carry more traffic or reach more users
Troubleshooting when something goes wrong
or performance is not as desired
Related to scalability
Configuring new devices/routers is always
problematic
Needs more automation
Great if it becomes plug-and-play (like home
routers)
28
Chapter 1
Requirements Summary
A computer network must provide general,
cost-effective, fair and robust connectivity
among large number of computers.
The network must be manageable by
number of varying levels of skills
29
Chapter 1
Network Architecture
30
Chapter 1
Network Architecture
31
Chapter 1
Abstraction and Layering
Abstraction
The hiding of details behind a well-defined interface
Define a model
Capture important aspects of the system
Abstractions naturally leads to layering
The general idea
Start from services offered by the underlying
hardware
Add a sequence of layers, each providing a
higher (i.e., more abstract) level of service.
Manageability and Mudularity
32
Chapter 1
Protocoals
The abstract objects the make up the layers of a
network system are called protocols
Building blocks of a network architecture
Each protocol object has two different interfaces
service interface: operations on this protocol
peer-to-peer interface: messages exchanged with
peer (indirect communication, except for the
hardware)
33
Chapter 1
Interfaces
34
Chapter 1
Protocols
Protocol Specification:
Written description (prose)
pseudo-code
state transition diagram
Packet format
RFCs: Request For Comments
IETF: Internet Engineering Task Force
Standardization body
Ex. RFC 2616 for HTTP protocol
Interoperable: when two or more protocols that
implement the specification accurately
35
Chapter 1
Protocol Graph
36
Chapter 1
Encapsulation
37
Chapter 1
Packets General Format
38
Chapter 1
OSI Architecture
39
Chapter 1
Description of Layers
Physical Layer
Handles the transmission of raw bits over a communication link
Data Link Layer
Collects a stream of bits into a larger aggregate called a frame
Network adaptor along with device driver in OS implement the
protocol in this layer
Frames are actually delivered to hosts
Network Layer
Handles routing among nodes within a packet-switched network
Provides Host-to-Host connectivity
packet
The lower three layers are implemented on all network nodes
40
Chapter 1
Description of Layers
Transport Layer
Implements a process-to-process channel
Unit of data exchanges in this layer is called a
message
There is a disagreement on the top three
Session, Presentation, and Application
Mainly because the are not always present
41
Chapter 1
Description of Layers
Session Layer
Provides a name space that is used to tie together the potentially
different transport streams that are part of a single application
Ex., tie the audio and video together in videoconference
Presentation Layer
Concerned about the format of data exchanged between peers
Ex., integer formats, audio/video format, most/least significant
Application Layer
Include things like the Hypertext Transfer Protocol
Basis the world wide web
Used by web browsers
The transport layer and the higher layers typically run only on end-
hosts and not on the intermediate switches and routers
42
Chapter 1
Internet Architecture
Sometimes called TCP/IP
Evolved from an earlier packet-switched
network called ARPANET
Internet and ARPANET were funded by ARPA
(Advanced Research Projects Agency)
Both existed before the OSI architecture
Both affected the OSI model
43
Chapter 1
Internet Architecture
44
Chapter 1
Internet Architecture
Defined by IETF
Three main features
Does not imply strict layering. The application is free to bypass
the defined transport layers and to directly use IP or other
underlying networks
An hour-glass shape – wide at the top, narrow in the middle and
wide at the bottom. IP serves as the focal point for the
architecture (host-to-host connectivity is separate from all
channel types)
45
Chapter 1
Internet Architecture
NET1, NET2, …
Could be Ethernet, Wireless, etc.
Encapsulate both hardware and data link layers from OSI model
IP (Internet Protocol)
Supports the interconnection of multiple networking technologies
into a single logical internetwork
Analogy to the network layer in the OSI
The routing protocol
46
Chapter 1
Internet Architecture
TCP provides reliable, byte-stream channel (connection
oriented protocol)
47
Chapter 1
Internet Architecture
Application Protocols
HTTP, FTP, Telnet (remote login), Simple Mail Transfer Protocol
(SMTP), and much more
48
Chapter 1
The Success of the Internet
1.8 billion Internet users
Much of its functionality is provided by
software running in general-purpose
computers
Small matter of programming
Massive increase in computing power
49
Chapter 1
Application Programming Interface
Interface exported by the network
Since most network protocols are implemented (those in
the high protocol stack) in software 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
The interface is called the network Application
Programming Interface (API)
50
Chapter 1
Application Programming Interface (Sockets)
51
Chapter 1
Socket
What is a socket?
The point where a local application process attaches
to the network
An interface between an application and the network
An application creates the socket
The interface defines operations for
Creating a socket
Attaching a socket to the network
Sending and receiving messages through the socket
Closing the socket
52
Chapter 1
Socket
Protocol Family
PF_INET denotes the Internet family
53
Chapter 1
Creating a Socket
int sockfd = socket(protocol_family, type, protocol);
Socket Type
SOCK_STREAM is used to denote a byte stream (TCP)
SOCK_DGRAM is an alternative that denotes a message
oriented service, such as that provided by UDP
54
Chapter 1
Client-Serve Model with TCP
Server
Passive open
Prepares to accept connection, does not actually establish a
connection
Server invokes
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)
55
Chapter 1
Client-Serve Model with TCP
Bind
Binds the newly created socket to the specified address i.e. the
network address of the local participant (the server)
Address is a data structure which combines IP and port
Listen
Defines how many connections can be pending on the specified
socket
56
Chapter 1
Client-Serve Model with TCP
Accept
Carries out the passive open
Blocking operation
Does not return until a remote participant has established a
connection
When it does, it returns a new socket that corresponds to the
new established connection and the address argument
contains the remote participant’s address
57
Chapter 1
Client-Serve Model with TCP
Client
Application performs active open
It says who it wants to communicate with
Client invokes
int connect (int socket, struct sockaddr *address,
int addr_len)
Connect
Does not return until TCP has successfully established a
connection at which application is free to begin sending data
Address contains remote machine’s address
58
Chapter 1
Client-Serve Model with TCP
In practice
The client usually specifies only remote participant’s
address and let’s the system fill in the local
information
Whereas a server usually listens for messages on a
well-known port
A client does not care which port it uses for itself, the
OS simply selects an unused one
59
Chapter 1
Client-Serve Model with TCP
60
Chapter 1
Example Application: Client
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
61
Chapter 1
Example Application: Client
/* translate host name into peer’s IP address */
hp = gethostbyname(host);
if (!hp) {
fprintf(stderr, "simplex-talk: unknown host: %s\n", host);
exit(1);
}
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
sin.sin_port = htons(SERVER_PORT);
/* active open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("simplex-talk: socket");
exit(1);
}
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
perror("simplex-talk: connect");
close(s);
exit(1);
}
/* main loop: get and send lines of text */
while (fgets(buf, sizeof(buf), stdin)) {
buf[MAX_LINE-1] = ’\0’;
len = strlen(buf) + 1;
send(s, buf, len, 0);
}
}
62
Chapter 1
Example Application: Server
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432
#define MAX_PENDING 5
#define MAX_LINE 256
int main()
{
struct sockaddr_in sin;
char buf[MAX_LINE];
int len;
int s, new_s;
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(SERVER_PORT);
63
Chapter 1
Example Application: Server
if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) {
perror("simplex-talk: bind");
exit(1);
}
listen(s, MAX_PENDING);
/* wait for connection, then receive and print text */
while(1) {
if ((new_s = accept(s, (struct sockaddr *)&sin, &len)) < 0) {
perror("simplex-talk: accept");
exit(1);
}
while (len = recv(new_s, buf, sizeof(buf), 0))
fputs(buf, stdout);
close(new_s);
}
}
64
Chapter 1
Performance
Old programming adage: ―first get it right and then make
it fast‖.
In networking: necessary to ―design for performance‖
65
Chapter 1
Bandwidth
Frequency band (measured in Hertz): we don’t mean that
Number of bits per second that can be transmitted over a
communication link
Throughput vs. bandwidth (from the most confusing
terms in computer networks.
Bandwidth: the maximum data rate (bits per second)
Throughput: number of bits per second that we actually transmit
over the link in practice
1 Mbps: 1 x 106 bits/second = 1x220 bits/sec
1 x 10-6 seconds to transmit each bit or imagine that a
timeline, now each bit occupies 1 micro second space.
On a 2 Mbps link the width is 0.5 micro second.
Smaller the width more will be transmission per unit time.
66
Chapter 1
Bandwidth
67
Chapter 1
Units Confusion
MB, Mbps, KB, Kbps
Mbps is always 106. Kbps is always 103
MB you can use 220 or 106
KB you can use 210 or 103
5% error
Bits and bytes
b (small letter) for bits
B (capital letter) for bytes (each byte is 8 bits,
you can use 10 sometimes, but with 20%
errors)
68
Chapter 1
Latency
How long it takes a message to travel from
one end of a network to the other.
Measured in time
69
Chapter 1
Latency
Three components
Speed-of-light propagation delay
Different media at different speeds
3.0 × 108 m/s in a vacuum
2.3 × 108 m/s in copper cable
2.0 × 108 m/s in optical fiber
Amount of time to transmit a unit of data
Queuing delays (switches store packets)
70
Chapter 1
Performance
Latency = Propagation + transmit + queue
Propagation = distance/speed of light
Distance: the length of the wire
Transmit = size/bandwidth
Size: the size of the packet
71
Chapter 1
Performance (ex1)
A client sends1-byte message to a server
and receives a 1-byte message
Suppose RTT = 100ms
RTT = propagation delay X 2
Case 1: bandwidth 1 Mbps
=> Transmit = 8 bits / 1Mbps = 8 micro seconds
Case 2: bandwidth 100 Mbps
=> Transmit = 8 bits / 100Mbps = 0.08 micro
seconds
Insignificant difference between Case 1 and 2
72
Chapter 1
Performance (ex2)
A client wants to download a 25MB image
Bandwidth 10Mbps
=>Transmit = 25 × 106 × 8 bits / 10 × 106
bits/sec = 20 seconds
Case 1: RTT = 100ms
Latency = 20.1 sec
Case 2: RTT = 1ms
Latency = 20.001 sec
Propagation delay is insignificant in this case
73
Chapter 1
FIGURE 1.17 Perceived latency (response time) versus round-trip time for
various object sizes and link speeds.
Network as a pipe
75
Chapter 1
Delay X Bandwidth
Relative importance of bandwidth and latency
depends on application
For large file transfer, bandwidth is critical
For small messages (HTTP, NFS, etc.), latency is
critical
76
Chapter 1
Delay X Bandwidth
The max number of bits that could be in transit
through the pipe at any given instant
How many bits the sender must transmit
before the first bit arrives at the receiver if the
sender keeps the pipe full
Takes another one-way latency to receive a
response from the receiver
If the sender does not fill the pipe (i.e., send a
whole delay × bandwidth product’s worth of
data before it stops to wait for a signal), then
the sender will not fully utilize the network
77
Chapter 1
Delay X Bandwidth
One-way latency of 50ms and a bandwidth
of 45 Mbps is able to hold
50 × 10-3s × 45 × 106 bits/s = 2.25 × 106 bits
This number is doubled if we consider the
RTT time instead of the one-way
Until the send hears the first bit from the
receiver to stop sending or something
Most of the time, we will be interested in
the RTT × Bandwidth
78
Chapter 1
High-Speed Networks
Bandwidths are increasing dramatically
What is the impact network design of having infinite
bandwidth available??!!
RTT dominates
What does not change as bandwidth increases: the
speed of light
You can not change the laws of physics
79
Chapter 1
Relationship between bandwidth and latency
80
Chapter 1
High-Speed Networks
Delay is 100 x 10-3 sec
File is 1MB
Bandwidth1 = 1Mbps
Bandwidth2 = 1Gbps
Delay x Bandwidth1 = 100 x 10-3 sec x 106 bits/sec = 105
bits
1MB / 105bits = 8 x 106 / 105 = 80
=> the file is 80 times larger than the channel
Delay x Bandwidth2 = 100 x 10-3 sec x 109 bits/sec = 108
bits
1MB / 108 bits = 8 x 106 / 108 = 1 / 12.5
=> the channel is 12.5 times larger than the file
81
Chapter 1
Throughput and TransferTime
The effective end-to-end throughput
Throughput = TransferSize / Latency
Latency= RTT + Size / Bandwidth
Insert the two-way, RTT to the formula instead of Prop. Delay
Ex., a user wants to fetch 1MB file across 1Gbps network
with a round-trip time of 100ms.
Transmit time = 1MB / 1Gbps = 8ms
Latency = RTT + transmit = 108ms
Effective throughput = 1MB/108ms = 74.1 Mbps
Much less than the available bandwidth
Transferring a larger amount of data will help improve the effective
throughput
large transfer size => throughput approaches the bandwidth
82
Chapter 1
Summary
We have identified what we expect from a computer
network
We have defined a layered architecture for computer
network that will serve as a blueprint for our design
We have discussed the socket interface which will be
used by applications for invoking the services of the
network subsystem
We have discussed two performance metrics using
which we can analyze the performance of computer
networks
83