Title: Computer Networks
1Computer Networks
- Definition and goals of networks
- Classification of networks
- Transmission media
- Types of network
- Packet switching
- Circuit switching
- Virtual-Packet circuit switching
- LANs and WANs
- The Internet
- Protocol stacks
2The problem
- Problem Given a set of devices that want to
exchange information. - (Device telephone, computer, terminals, etc.)
- Simple Solution Connect each pair of devices by
a dedicated point-to-point link - The simple solution is sufficient if the number
of devices is small.
3The problem (cont)
- With a large number of devices it is not
practical to connect each pair of devices
4Solution ??
- A communication network provides a general
solution to the problem of connecting many
devices - Connect each device to a network node
- Network nodes exchange information and carry the
information from a source device to a destination
device - Note Network nodes do not generate information
5What is a computer network ?
An interconnection of autonomous computers (as
opposed to communication between separate but
interdependent parts of a single computer)
6Goals of computer networks
- Access to remote resources
- Human communication
- Mobile computing
- Computing power through parallelism
- Optimising resources - load balancing
- Incremental growth of computer systems (reduced
cost and risk) - Increased robustness through graceful degradation
7Uses of computer networks
- Email, World Wide Web, Video Conferencing, File
Transfer, Collaborative Virtual Environments,
Remote control of robots and machines, Dial up
databases, Web-casting, Distributed Programs,
Hacking, Banking, Internet telephone
8Classification of networks
- By size
- Local area networks (LANs)
- Metropolitan Area Networks (MANs)
- Wide area networks (WANs)
- By media type
- Point to point networks vs. broadcast networks
- By mobility
- Mobile networks vs fixed networks
- The Internet?
9Issues for local and wide area
- Scale - geographic and number of computers
- Speed - bandwidth and latency
- Management
- Security
- Billing
- Heterogeneity (and standards)
10Transmission media
The transmission medium is the physical path
between transmitter and receiver in a data
transmission Transmission medium can be Simplex
- Transmission in one direction only Half-duplex
- Transmission in both directions but not at the
same time Full duplex (duplex) - Simultaneous
transmission in both directions
11Transmission media
- Copper Wire
- Glass Fibre
- Microwave
- Infrared
12Comparing transmission media
- Various transmission media with different
properties in terms of - range
- capacity to carry information
- cost
- directionality
- reliability (noise and blocking)
13Types of network
- Packet switching store and forward messages
(Internet) - Circuit switching Carry bit streams (old
telephone network)
14Circuit switching
- In a circuit-switched network, a dedicated
communication path is established between two
stations through the nodes of the network - The dedicated path is called a circuit-switched
connection or circuit
15Circuit switching (cont)
- A circuit occupies a fixed capacity of each link
for the entire lifetime of the connection.
Capacity unused by the circuit cannot be used by
other circuits - Data is not delayed at the switches
16Circuit switching (cont)
- Circuit-switched communication involves three
phases - 1. Circuit Establishment
- 2. Data Transfer
- 3. Circuit Termination
- Busy Signal if capacity for a circuit not
available. - Most important circuit-switching networks
- Telephone networks
- ISDN (Integrated Services Digital Networks)
17Circuit switching (cont)
18Circuit switching (cont)
19Packet switching
- Most networks transmits data in small blocks
called packets - helps in detect transmission errors
- gives fair access for a shared connection between
many computers - These are packet networks or packet switching
networks
20Packet switching
- Data are sent as formatted bit-sequences,
so-called packets. - Packets have the following structure
- Header and Trailer carry control information
Header
Data
Trailer
21Packet switching (cont)
- Each packet is passed through the network from
node to node along some path (Routing) - At each node the entire packet is received,
stored briefly, and then forwarded to the next
node (Store-and-Forward Networks) - No capacity is allocated for packets
22Packet switching (cont)
23Packet switching (cont)
24Virtual-Circuit Packet switching
- Virtual-circuit packet switching is a hybrid of
circuit switching and packet switching - All data is transmitted as packets
- All packets from one packet stream are sent along
a pre-established path (virtual circuit) - Guarantees in-sequence delivery of packets
25Virtual-Circuit Packet switching (cont)
- Communication with virtual circuits (VC) takes
place in three phases - 1. VC Establishment
- 2. Data Transfer
- 3. VC Disconnect
- Note Packet headers dont need to contain the
full destination address of the packet
26Virtual-Circuit Packet switching (cont)
27Switching Summary
28Summary (cont)
- Telephone network
- The largest world-wide computer network,
specialised for voice. - Circuit switching
- Internet
- A new global and public information structure
- Datagram packet switching
- ATM
- Was intended to replace telephone networks and
data networks but lost momentum due to the
success of the Internet - Virtual-Circuit packet switching
29Local Area Networks
- Shared LANs invented in the 1960s
- Rely on computers sharing a single medium
- Computers co-ordinate their access
- Low cost
- But not suitable for wide area due to
communication delays inhibiting co-ordination
30Local Area Networks (cont)
- LANs may be categorised according to topology
- Star
- Ring
- Bus
31Local Area Networks (cont)
Computers connected to a network
Hub
Star - ATM
32Local Area Networks (cont)
Connection from one computer to another
Ring -IBM Token Ring
33Local Area Networks (cont)
Cable connection (Ethernet)
Bus - Ethernet
34Wide Area Networks
- Key goal is scale-ability
- Composed of many packet switches
- Store and forward approach instead of shared
medium - Each packet switch does next hop routing by using
a local routing table
35Example WAN technologies
36Wide Area Networks
- Key goal is scale-ability
- Composed of many packet switches
- Store and forward approach instead of shared
medium - Each packet switch does next hop routing by using
a local routing table
37What can go wrong ??
- Bit-level errors (electrical interference)
- Packet-level errors (congestion)
- Link and node failures
- Messages are delayed
- Messages are deliver out-of-order
- Third parties eavesdrop.
38The Internet
- Global inter-connection of different networks
- The Internet is a datagram packet-switching
network - Station or Endsystems are called Hosts
- Nodes are called Routers
39HTTP- The World Wide Web Protocol
40Web Architecture
- The Web is a client-server architecture
- Servers and browsers use the HTTP protocol
41Server and Client Examples
- Server software
- Apache
- Microsoft IIS
- Netscape Web Server
- Client software
- Netscape Navigator
- Internet Explorer
42HTTP
- 80 of Internet flows are HTTP connections
- Early protocol is HTTP 0.9
- read, execute (only).
- Today we mostly use HTTP 1.0
- read, input, delete, execute, ...
- New version HTTP 1.1
- performance optimizations
43HTTP Overview
- Client (browser) sends HTTP request to server
(usually port 80) - Request specifies URL and operation
- Server performs operation on URL
- Server sends response
- Client parses response possibly follows link to
(request) another URL.
44HTTP Operations
- GET retrieves URL (most widely used)
- HEAD retrieves only response header
- POST posts data to server
- PUT puts page on server
- DELETE deletes page from server
45HTTP Headers
- HTTP headers are in pure text
- Request header
- operation, requested URL, protocol version,
- blank line
- Response header
- protocol version, operation status, content
length, content type, - blank line
46Simple HTTP Request and Reply
- Request
- GET http//www.server.com/page.html HTTP/1.0
- ltblank linegt
- Response
- HTTP-Version HTTP/1.0 200 OK
- Content-Length 3012
- Content-Type text/html
- ltblank linegt
- ltbodygt
47Example
- Establish a connection to web server port 80
using - telnet www.scarlet.cs.nott.ac.uk 80
- When the connection is established try
- GET /index.html HTTP/1.0
- Hit Enter twice to create a blank line after
header
48HTTP 1.0
- Client opens a separate TCP connection for each
requested object - Object is served and connection is closed
- Advantages
- maximum concurrency
- Limitations
- TCP connection setup/tear-down overhead
- TCP slow start every time
49Authentication
- Server may request client authentication by
issuing code 401 in response header, e.g. - HTTP-Version HTTP/1.0 401 Unauthorized
- WWW-Authenticate Basic RealmTopSecretDoc
- Client must then send valid ID and password in
request header - Authentication tokens are commonly named cookies
50Sessions
- HTTP 1.0 is stateless (no concept of client
sessions) - To maintain session state (e.g., a shopping cart)
server must perform authentication on every
request - State can be encoded in cookies
- Back-end applications invoked by server to map
authenticated cookies to session state
51HTTP 1.1
- To avoid a connection per object model, HTTP 1.1
supports persistent connections - Client opens TCP connection to server
- All requests use same connection
- Problems
- Less concurrency
- Server does not know when to close idle
connections
52Static Content and HTML
- Most static web content is written in HTML
- HTML allows
- Text formatting commands
- Embedded objects
- Links to other objects (Hypertext)
- Server need not understand or interpret HTML
53Fetching Multiple Objects
- Most web-pages contain embedded objects (e.g.,
images, backgrounds, etc) - Browser requests HTML page
- Server sends HTML file
- Browser parses file and requests embedded objects
- Server sends requested objects
54Dynamic Content
- Web pages can be created as requests arrive
- Advantages
- Personalization (e.g., my.yahoo.com),
- interaction with client input
- interaction with back-end applications
- Disadvantages
- Performance penalty
- Generating dynamic content (CGIs, ASPs)
55Common Gateway Interface (CGI) Scripts
- URLs with a .cgi extension denote CGIs
- The script is a program (e.g., C, JAVA, )
- When the URL is requested, server invokes the
named script, passing to it client info - Script outputs HTML page to standard output
(redirected to server) - Server sends page to client
56Fast CGI
- CGI scripts are invoked on each request
- Invocation overhead is large (e.g., UNIX fork())
- Fast CGIs are invoked a priori and blocked on
server I/O - Client requests unblock script
- Script outputs page and blocks again
57Active Server Pages (ASPs)
- Active server pages are HTML documents with
extensions for embedded program execution - When request arrives, server fetches and parses
the HTML document - Server executes embedded executable code and
plugs output into page - Expanded page is sent to client
58Web Caching
- Caching improves perceived performance
59Types of Web Caching
- The cache retains most popular URLs
- Client caching
- browser caches URLs for future access
- Proxy caching
- proxy server caches most requested URLs
- Server-side caching
- server-side cache reduces load on server
60Caching Policies
- A URL is cached when it is requested
- Cache must replace content when full
- Cache replacement policies
- LRU (replace least recently used page)
- LFU (replace least frequently used page)
- Other considerations
- page size, client importance, cache distance from
server
61LFU
- Replaces least frequently used page
- Optimal replacement policy if
- all pages have same size
- page popularity does not change
- In practice has disadvantages
- slow to react to popularity changes
- needs to keep statistics (counter) for every page
- does not consider page size
62LRU
- Replaces least recently used page
- maintains linked list of pages
- each newly fetched page is put on head of list
- tail page is deleted when storage is exceeded
- Exploits temporal locality
- Performs better than LFU in practice
- No per-page counters
- Used in todays caches (e.g., Squid)
63Cache Consistency Management
- Problem with caching
- Cached pages may get modified on server
- Clients accessing cache will get stale copy
- Possible solutions
- Finite time-to-live
- Invalidation
- Invalidation contracts
64Time-to-live Conditional GET
- Server specifies a time-to-live for requested
page - Proxy caches page and serves subsequent clients
until time-to-live expires - Proxy sends if-modified-since query to server on
subsequent request(s) - Server sends page if it was modified
- (presently used method)
65Cache Invalidation
- Server remembers where its pages are cached
- When a page is modified, server sends
invalidation messages to caches - Caches mark page as stale
- Subsequent client requests will fetch fresh copy
from server
66Invalidation Contracts
- Invalidation traffic can get very large
- To limit invalidations server gives invalidation
contracts to caches - Contracts have expiration time
- When content changes server notifies only those
caches whose contract has not expired