Principles of Computer Systems
Autumn 2019
Stanford University
Computer Science Department
Instructors: Chris Gregg
Philip Levis
Internet
Internet
open a connection
Internet
GET / HTTP/1.1
write a request
Internet
GET / HTTP/1.1
read the request
Internet
HTTP/1.1 200 OK document data
write the response
Internet
HTTP/1.1 200 OK document data
read the response
Internet
BitTorrent peers
Client
Internet
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
Internet
Application
Transport
Network
Link
Network
Link
Network
Link
Network
Link
Application
Transport
Network
Link
How many hops do you think it is from here to MIT? UC Berkeley?
Application
Presentation
Session
Transport
Network
Link
Physical
Application level data: HTTP
Let's not worry about this one
A communication session: TLS
Application: TCP, UDP ports
Node: IP address
A network interface: MAC
How you encode bits
partysaur:~ pal$ telnet www.scs.stanford.edu 80 Trying 2001:470:806d:1::9... Connected to www.scs.stanford.edu. Escape character is '^]'. GET / HTTP/1.1 Host: www.scs.stanford.edu HTTP/1.1 200 OK Connection: keep-alive Content-Length: 5624
Internet
Proxy Server
Client
Web Server
Middlebox
Client
Web Server
Middlebox
Client
Web Server
$ ./proxy
Listening for all incoming traffic on port 19419.
GET http://www.cornell.edu/research/ HTTP/1.1
GET /research/ HTTP/1.1
Internet
Proxy Server
Client
Web Server
GET http://www.cornell.edu/research/ HTTP/1.1
GET /research/ HTTP/1.1
x-forwarded-proto: allows a server sitting behind a load-balancing proxy to be sure that the client request to the proxy was secure (https: instead of http:)
We're not going to worry about this use case, but we have to support it
Set its value to be http. If x-forwarded-proto is already included in the request header, then simply add it again.
x-forwarded-for: 172.27.76.96
x-forwarded-for: 172.27.76.96, 172.27.76.12
map(k1, v1) -> list(k2, v2)
reduce(k2, list(v2)) -> list(v2)
map(String key, String value):
// key: document name
// value: document contents
for word w in value:
EmitIntermediate(w,"1")
reduce(String key, List values):
// key: a word
// values: a list of counts
int result = 0
for v in values:
result += ParseInt(v)
Emit(AsString(result))
"The number of partitions (R) and the partitioning function are specified by the user."
("the", "1") , ("the", "1"), ("The", "1"), ("of", 1),
(number, "1"), ...
"the", ("1", "1") -> "2"
"The", ("1") -> "1"
"of", ("1") -> "1"
"number", ("1") -> "1"
map output
input
reduce
map(k1, v1) -> list(k2, v2)
reduce(k2, list(v2)) -> list(v2)
Google's IPO was September 2004