Foundation: Larry L. Peterson and Bruce S. Davie
Foundation: Larry L. Peterson and Bruce S. Davie
Chapter 1
Foundation
2
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 .
Define key metrics that will be used to evaluate
the performance of computer network.
3
Chapter 1
Problems
How to build a scalable network that will support
different applications?
What is a computer network?
How is a computer network different from other
types of networks?
What is a computer network architecture?
4
Chapter 1
Applications
Most people know about the Internet (a
computer network) through applications
World Wide Web
Email
Online Social Network
Streaming Audio Video
File Sharing
Instant Messaging
…
5
Chapter 1
Types of internet techies
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
List the characteristics of a system that is easy to
manage- hub failure disables the whole network
6
Chapter 1
Classes of applications
Traditional applications
textual and graphical: URL
Streaming applications
audio and video applications:online videos
real time audio and video applications:
live videos, skype
7
Chapter 1
Application Protocol
URL
Uniform resource locater
http://www.cs.princeton.edu/~llp/index.html
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 request and acknowledgement
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
8
Chapter 1
9
Chapter 1
10
Chapter 1
11
Chapter 1
12
Chapter 1
13
Chapter 1
Example of an application
14
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
List the characteristics of a system that is easy to
manage
15
Chapter 1
Connectivity
Need to understand the
following terminologies
Scale
Link
Nodes
Point-to-point
Multiple access
Switched Network
Circuit Switched
Packet Switched
Packet, message
Store-and-forward
(a) Point-to-point
(b) Multiple access
16
Chapter 1
Connectivity
Terminologies (contd.)
Cloud
Hosts
(a)
Switches
internetwork
Router
Bridge
gateway
Host-to-host connectivity
Address
Routing
Unicast/broadcast/multicast
17
Chapter 1
b)Interconnection of networks
18
Chapter 1
Cost-Effective Resource Sharing
Resource: links and
nodes
How to share a link?
Multiplexing
De-multiplexing
Synchronous Time-division
Multiplexing
Time slots/data
transmitted in
predetermined slots
Multiplexing multiple logical flows
over a single physical link
19
Chapter 1
Cost-Effective Resource Sharing
FDM: Frequency Division
Multiplexing
20
Chapter 1
21
FDM
Chapter 1
FDM Example
22
Chapter 1
23
TDM
Chapter 1
TDM Example
24
Chapter 1
Support for Common Services
Logical Channels
Application-to-Application communication path or a
pipe
25
Chapter 1
Identifying common communication patterns
3 steps
Understanding the communication
needs.
Extracting the communication
requirement.
Incorporating the requirement.
26
Chapter 1
Common Communication Patterns
Client/Server: file request
Two types of communication channel
Request/Reply Channels: file transfer: ensure data
delivery at receiver side, privacy, integrity
27
Chapter 1
Reliability
aim of data communication is to ensure reliable
delivery of message.
Network should hide the errors.
physical errors: m/c crash, channels break,
electrical interference, switch buffer out of space
etc.
Software errors: bugs, false destination,
corruption caused by s/w programs, abrupt
termination of programs.
28
Chapter 1
Causes of failure
3 levels of failure
1.Bit level failure: Bits are lost
Bit errors (1 to a 0, and vice versa)
Burst errors – several consecutive errors
2.Packet level failure: Packets are lost.
3.Links and Node failures: physical
breakage in the links and nodes.
Messages are delayed.
Messages are delivered out-of-order.
Third parties eavesdrop.
29
Chapter 1
Manageability
It includes managing the network: making
changes as the n/w grows to carry more
traffic and trouble shooting the n/w when
the things go wrong.
Responsibility of a n/w operators.
Ensures scalability and cost effective
allocation of resources.
30
Chapter 1
Network Architecture
31
Chapter 1
Network Architecture
32
Chapter 1
Protocols
Protocol defines the interfaces between the
layers in the same system and with the layers of
peer system
Building blocks of a network architecture
Each protocol object has two different interfaces
service interface
peer-to-peer interface
33
Chapter 1
Figure 2.5: Communication through an internet
2.34
34
Chapter 1
Interfaces
35
Chapter 1
Protocol Graph
36
Chapter 1
Encapsulation
37
Chapter 1
Figure 2.8: Encapsulation / Decapsulation
2.38
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
Unit of data exchanged between nodes in this layer is called a
packet
40
Chapter 1
Description of Layers
Transport Layer
Implements a process-to-process channel
Unit of data exchanges in this layer is called a
segment/datagram message
Session Layer
Establishes a dialog for communication, encryption/decryption,
data compression.
Presentation Layer
Concerned about the format of data exchanged between peers
Application Layer
Standardize common type of exchanges
The transport layer and the higher layers typically run only on end-
hosts and not on the intermediate switches and routers
41
Chapter 1
Internet Architecture
42
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
In order for a new protocol to be officially included in the
architecture, there needs to be both a protocol specification and
at least one (and preferably two) representative implementations
of the specification
43
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)
44
Chapter 1
Application Programming Interface (Sockets)
45
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
46
Chapter 1
Socket
Socket Family
PF_INET denotes the Internet family
PF_UNIX denotes the Unix pipe facility
PF_PACKET denotes direct access to the network
interface (i.e., it bypasses the TCP/IP protocol stack)
Socket Type
SOCK_STREAM is used to denote a byte stream
SOCK_DGRAM is an alternative that denotes a
message oriented service, such as that provided by
UDP
47
Chapter 1
Creating a Socket
int sockfd = socket(address_family, type, protocol);
48
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)
49
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
50
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
51
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
52
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
53
Chapter 1
Client-Serve Model with TCP
54
Chapter 1
Example Application: Client
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
55
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);
}
}
56
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);
57
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);
}
}
58
Chapter 1
Performance
Bandwidth
Width of the frequency band
Number of bits per second that can be transmitted over a
communication link
1 Mbps: 1 x 106 bits/second in 1micro second.
On a 2 Mbps link the width is 0.5 micro second.
Smaller the width more will be transmission per unit time.
59
Chapter 1
Bandwidth
60
Figure 3.17: Two digital signals: one with two signal levels and the
Chapter 1
other with four signal levels
3.61
61
Chapter 1
Performance
Latency: total time required by the entire message to
completely arrive at the destination.
Latency = Propagation + transmit + queue
Propagation time: measures the time required for a bit to
travel from source to destination.
Propagation = distance/speed of light
Transmit time: time required for the first bit to leave the
sender and arrive at the destination.
Transmit time = size/bandwidth
One bit transmission => propagation is important
Large bytes transmission => bandwidth is important
62
Chapter 1
Delay X Bandwidth
We think the channel between a pair of processes as a
hollow pipe
Latency (delay) length of the pipe and bandwidth the
width of the pipe
Delay of 50 ms and bandwidth of 45 Mbps
50 x 10-3 seconds x 45 x 106 bits/second
2.25 x 106 bits = 280 KB data.
Network as a pipe
63
Chapter 1
Figure 3.32: Filling the links with bits for Case 1
3.64
64
Chapter 1
Figure 3.33: Filling the pipe with bits for Case 2
3.65
65
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
Variance in latency (jitter) can also affect some
applications (e.g., audio/video conferencing)
66
Chapter 1
Delay X Bandwidth
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—send a
whole delay × bandwidth product’s worth of
data before it stops to wait for a signal—the
sender will not fully utilize the network
67
Chapter 1
Delay X Bandwidth
Infinite bandwidth
RTT dominates
Throughput = TransferSize / TransferTime
TransferTime = RTT + 1/Bandwidth x
TransferSize
Its all relative
1-MB file to 1-Gbps link looks like a 1-KB
packet to 1-Mbps link
68
Chapter 1
Relationship between bandwidth and latency
69
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
70