Introduction to Computer Systems a Client-Server Transaction

Introduction to Computer Systems a Client-Server Transaction

Carnegie Mellon Carnegie Mellon A Client‐Server Transaction 1. Client sends request Client Server Introduction to Computer Systems process process Resource 4. Client 3. Server sends response 2. Server 15‐213/18‐243, fall 2009 handles handles 18th Lecture, Nov. 3rd response request Note: clients and servers are processes running on hosts (can be the same or different hosts) Instructors: Roger Dannenberg and Greg Ganger Most network applications are based on the client‐server model: A server process and one or more client processes Server manages some resource Server provides service by manipulating resource for clients Server activated by request from client (vending machine analogy) Carnegie Mellon Carnegie Mellon Hardware Organization of a Network Host Computer Networks CPU chip register file A network is a hierarchical system of boxes and wires organized by geographical proximity ALU Data center networks: spans cluster or machine room system bus memory bus Switched Ethernet, Infiniband, … LAN (Local Area Network) spans a building or campus I/O main MI Ethernet is most prominent example bridge memory WAN (Wide Area Network) spans country or world Typically high‐speed point‐to‐point phone lines Expansion slots An internetwork (internet) is an interconnected set of I/O bus networks USB graphics disk network The Global IP Internet (uppercase “I”) is the most famous example controller adapter controller adapter of an internet (lowercase “i”) mouse keyboard monitor Let’s see how an internet is built from the ground up disk network Carnegie Mellon Carnegie Mellon Lowest Level: Ethernet Segment Next Level: Bridged Ethernet Segment host host host AB host host host host host 100 Mb/s 100 Mb/s hub X hub 100 Mb/sbridge 100 Mb/s hub port 1 Gb/s host host Ethernet segment consists of a collection of hosts connected 100 Mb/s 100 Mb/s by wires (twisted pairs) to a hub hub bridge hub Y Spans room or floor in a building host host host host host Operation C Each Ethernet adapter has a unique 48‐bit address (MAC address) Hosts send bits to any other host in chunks called frames Spans building or campus Hub slavishly copies each bit from each port to every other port Every host sees every bit Bridges cleverly learn which hosts are reachable from which Note: Hubs are on their way out. Bridges (switches, routers) became cheap enough ports and then selectively copy frames from port to port to replace them (means no more broadcasting) Carnegie Mellon Carnegie Mellon Conceptual View of LANs Next Level: internets For simplicity, hubs, bridges, and wires are often shown as a Multiple incompatible LANs can be physically connected by collection of hosts attached to a single wire: specialized computers called routers The connected networks are called an internet host host ... host host host ... host host host ... host LAN LAN router router router WAN WAN LAN 1 and LAN 2 might be completely different, totally incompatible (e.g., Ethernet and Wifi, 802.11*, T1‐links, DSL, …) Carnegie Mellon Carnegie Mellon Logical Structure of an internet The Notion of an internet Protocol host How is it possible to send bits across incompatible LANs router host router router and WANs? router Solution: router router protocol software running on each host and router smooths out the differences between the different networks Ad hoc interconnection of networks Implements an internet protocol (i.e., set of rules) No particular topology governs how hosts and routers should cooperate when they Vastly different router & link capacities transfer data from network to network Send packets from source to destination by hopping through TCP/IP is the protocol for the global IP Internet networks Router forms bridge from one network to another Different packets may take different routes Carnegie Mellon Carnegie Mellon What Does an internet Protocol Do? Transferring Data Over an internet LAN1 Host A Host B LAN2 Provides a naming scheme client server An internet protocol defines a uniform format for host addresses Each host (and router) is assigned at least one of these internet (1) data (8) data addresses that uniquely identifies it protocol protocol internet packet software software (2) data PH FH1 (7) data PH FH2 Provides a delivery mechanism LAN1 frame An internet protocol defines a standard transfer unit (packet) LAN1 LAN2 adapter adapter Packet consists of header and payload Router (3) data PH FH1 (6) data PH FH2 Header: contains info such as packet size, source and destination LAN1 LAN2 addresses adapter adapter Payload: contains data bits sent from source host LAN2 frame (4) data PH FH1 data PH FH2 (5) protocol PH: Internet packet header software FH: LAN frame header Carnegie Mellon Carnegie Mellon Other Issues Global IP Internet We are glossing over a number of important questions: Most famous example of an internet What if different networks have different maximum frame sizes? (segmentation) Based on the TCP/IP protocol family How do routers know where to forward frames? IP (Internet protocol) : How are routers informed when the network topology changes? Provides basic naming scheme and unreliable delivery capability What if packets get lost? of packets (datagrams) from host‐to‐host UDP (Unreliable Datagram Protocol) Uses IP to provide unreliable datagram delivery from These (and other) questions are addressed by the area of process‐to‐process systems known as computer networking TCP (Transmission Control Protocol) Uses IP to provide reliable byte streams from process‐to‐process over connections Accessed via a mix of Unix file I/O and functions from the sockets interface Carnegie Mellon Carnegie Mellon Hardware and Software Organization Naming and Communicating on the Internet of an Internet Application Original Idea Every node on Internet would have unique IP address Everyone would be able to talk directly to everyone Internet client host Internet server host No secrecy or authentication Client User code Server Messages visible to routers and hosts on same LAN Sockets interface Possible to forge source field in packet header (system calls) TCP/IP Kernel code TCP/IP Doesn’t always work this way Hardware interface (interrupts) We may talk about some evolution, if time allows Network Hardware Network See slides at end (for fun), if not adapter and firmware adapter Global IP Internet Carnegie Mellon Carnegie Mellon A Programmer’s View of the Internet IP Addresses 32‐bit IP addresses are stored in an IP address struct Hosts are mapped to a set of 32‐bit IP addresses IP addresses are always stored in memory in network byte order 128.2.203.179 (big‐endian byte order) True in general for any integer transferred in a packet header from one The set of IP addresses is mapped to a set of identifiers machine to another. called Internet domain names E.g., the port number used to identify an Internet connection. 128.2.203.179 is mapped to www.cs.cmu.edu /* Internet address structure */ struct in_addr { unsigned int s_addr; /* network byte order (big-endian) */ A process on one Internet host can communicate with a }; process on another Internet host over a connection Useful network byte‐order conversion functions: htonl: convert long int from host to network byte order htons: convert short int from host to network byte order ntohl: convert long int from network to host byte order ntohs: convert short int from network to host byte order Carnegie Mellon Carnegie Mellon Dotted Decimal Notation Dotted Decimal Notation By convention, each byte in a 32‐bit IP address is represented By convention, each byte in a 32‐bit IP address is represented by a string: decimal values for bytes, separated by a period by a string: decimal values for bytes, separated by a period IP address: 0x8002C2F2 = 128.2.194.242Blackboard? IP address: 0x8002C2F2 = 128.2.194.242 Functions for converting between binary IP addresses and dotted decimal strings: inet_aton: dotted decimal string → IP address in network byte order inet_ntoa: IP address in network byte order → dotted decimal string “n” denotes network representation “a” denotes application representation Carnegie Mellon Carnegie Mellon IP Address Structure Internet Domain Names IP (V4) Address space divided into classes: unnamed root 0 1 2 3 8 16 24 31 Class A 0 Net ID Host ID First‐level domain names Class B 1 0 Net ID Host ID .net .edu .gov .com Class C 1 1 0 Net ID Host ID Class D 1 1 1 0 Multicast address mit cmu berkeley amazon Second‐level domain names Class E 1 1 1 1 Reserved for experiments Network ID written in form w.x.y.z/n cs ece www Third‐level domain names n = number of bits in net id (yellow part above) 208.216.181.15 E.g., CMU written as 128.2.0.0/16 Which class is that? cmcl pdl Unrouted (private) IP addresses: 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 kittyhawk imperial 128.2.194.242 128.2.189.40 Nowadays: CIDR (Classless interdomain routing) Carnegie Mellon Carnegie Mellon Domain Naming System (DNS) Properties of DNS Host Entries The Internet maintains a mapping between IP addresses and Each host entry is an equivalence class of domain names and domain names in a huge worldwide distributed DNS database IP addresses Conceptually, programmers can view the DNS database as a collection of millions of host entry structures: Each host has a locally defined domain name localhost which always maps to the loopback address 127.0.0.1 /* DNS host entry structure */ struct hostent { Different kinds of mappings are possible: char *h_name; /* official domain

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us