Chapter 11 by David G. Messerschmitt Understanding Networked Applications:

advertisement
Understanding Networked Applications:
A First Course
Chapter 11
by
David G. Messerschmitt
Understanding Networked Applications:
A First Course
Algorithms and protocols
by
David G. Messerschmitt
Algorithm
• Specified sequence of steps that
– accomplish a designated task
– in a finite number of steps
• Representation:
– simple algorithm: flowchart
– complicated algorithm: program
Understanding Networked Applications
3
A First Course
Example: one turn at monopoly
Start
turn
Move token number
of squares indicated
on dice
Throw
dice
Move to
“jail” square
Yes
Land on “go
to jail”?
No
Finish
turn
Understanding Networked Applications
Do not move;
follow policies
for square
(like “pay rent”)
4
A First Course
Algorithm building blocks
Start
Start
Start
Programming
languages support
these three
building blocks
Action
Decision
Action
Action
Test
Action
Action
Action
Finish
Sequence
Finish
Finish
Selection
Loop
Understanding Networked Applications
5
A First Course
Protocol
• Distributed algorithm realized by two or
more modules to coordinate their actions or
accomplish some shared task
• Module interoperability requires a protocol
– Prescribed order of method invocations
– Part of interface documentation
Understanding Networked Applications
6
A First Course
Monopoly players protocol
Player 1
Player 2
One-turn
algorithm
This is a protocol
interaction diagram
Understanding Networked Applications
Time
7
A First Course
Application and infrastructure
The application defines its own
application-level protocols
Internally, the network
uses protocols
to implement the
services it provides
Understanding Networked Applications
8
A First Course
Three simple protocols
• One-way message: send-receive
• Two-way interaction: request-response
• Push: publish-subscribe
Understanding Networked Applications
9
A First Course
Client
Server
send
receive
request
response
subscribe
responses
Time
Understanding Networked Applications
10
A First Course
Example: HTTP
 User activates URL
 HTTP request
HTTP client
(browser)
 Browser displays
document (if HTML)
or invokes “helper
application”
HTTP server
 HTTP response
(embedded document)
Understanding Networked Applications
HTML
documents
11
A First Course
Example: Stock trading
Customer
Customer wants to
purchase 10 shares of
MSFT if price is below
$90
StockTrader
What is application protocol?
Understanding Networked Applications
12
A First Course
Understanding Networked Applications:
A First Course
Locating things
by
David G. Messerschmitt
Three ways of locating things
• Name
– “Joe Bloe”
• Address
– “1299 Hearst St, Berkeley, CA”
• Reference
– “Postmaster of Berkeley CA”
Understanding Networked Applications
14
A First Course
Name
• Symbolic (character string) representation
• Easy for people to remember or guess
• Identifies but does not locate directly
– Distinction important for mobile entities
• Not unique: entities can have more than one
name (called aliases)
Understanding Networked Applications
15
A First Course
Hierarchical names
• Hierarchy makes names easier to remember
or guess
• Host domain names:
– “info.sims.berkeley.edu”
– designates administrative hierarchy
• File names:
– “c:\My Documents\Docs\Resume.doc”
– designates folder hierarchy
Understanding Networked Applications
16
A First Course
Address
• Route or path to entity
– is directly specified, or
– can be inferred
• Independent of who or what is locating
entity
• Topological specification
Understanding Networked Applications
17
A First Course
Example
4
3
1
2
Path from
to
is (1,2,2,2,1,1,1,1)
Not an address, because it depends on starting point
Understanding Networked Applications
18
A First Course
Example
(1,1) (1,2) (1,3) (1,4) (1,4)
(2,1)
(2,2)
(2,3)
(2,4)
(2,5)
Address of
is (2,5)
Route from
can be inferred
Understanding Networked Applications
19
A First Course
Reference
• Abstract representation of an entity
• Interaction is with representation
– infrastructure arranges redirection to actual
entity
– especially appropriate for things that move
Understanding Networked Applications
20
A First Course
Reference
Client
Server
address
Understanding Networked Applications
21
A First Course
Name services
3. interaction
1. name
2. address
or reference
Name
service
Understanding Networked Applications
22
A First Course
Download