计算原理导论 Introduction to Computing Principles 天津大学 计算机科学与技术学院 刘志磊
Network TCP/IP WWW E-Mail Networking • Computer Networks are like a phone system for computers • A computer places a "call" to exchange data with another computer • Basic outline is surprisingly simple, complex details • Worth knowing the basics, you are using the network constantly Introduction to computing principles Network
Network TCP/IP WWW E-Mail LAN - Local Area Network • Start with small scale • LAN - Local Area Network • One house, one floor of a building • e.g. Ethernet ( 以太网 ) , wired LAN • e.g. Wi-Fi, wireless LAN • Later, show scale up to world-wide internet Introduction to computing principles Network
Network TCP/IP WWW E-Mail Ethernet LAN • Look at Ethernet first • Wi-Fi is very similar • Very popular wired LAN technology (since 1974) • Wires about as thick as a drinking straw-100 meter max wire length – local • Wires often yellow or blue Introduction to computing principles Network
Network TCP/IP WWW E-Mail Ethernet cables plugged into the back of Ethernet RJ45 plug a Wi-Fi router (RJ: Registered Jack) Introduction to computing principles Network
Network TCP/IP WWW E-Mail Packets Data From Here to There • Send image from one computer to another on Ethernet • This is the "one hop" case (scale up to whole world later) • - e.g. 50KB image.jpg • How to send the image.jpg on the wire? • Packets • Divide bytes of image.jpg into packets • Say each packet is 1500 bytes (varies) • Then image.jpg divides into about 32 packets • Ethernet: transmit one packet between computers Introduction to computing principles Network
Network TCP/IP WWW E-Mail Ethernet • Sending One Packet • Look at transmission of one 1500 byte packet • Each byte is 8 bits, e.g. 0 1 1 0 1 0 1 0 • 1500 * 8 = 12000 bits total • Send each byte (slight simplification): • Go through all the bits, from left to right • For each 1, put 3 volts on the wire; For each 0, put 0 volt Digital Transmission • Happens at about 1/3 the speed of light in the wire Introduction to computing principles Network
Network TCP/IP WWW E-Mail Checksum vs. Errors • 1 Gigabit networking = 1 billion bits per second • Detect the occasional error, a bit is wrong • Checksum - receiver can detect that the packet was received correctly • Example checksum scheme: Introduction to computing principles Network
Network TCP/IP WWW E-Mail Checksum vs. Errors • Very likely to detect errors • Not perfect - 2 errors could cancel out • Actual checksum schemes used are better than just the sum • Checksums are very widely used: Ethernet, USB, Wi-Fi, ... everything! Introduction to computing principles Network
Network TCP/IP WWW E-Mail Multiple Computers - Ethernet LAN Design • Ethernet - historic, elegant design • One wire shared by all the computers • No central control - distributed, collaborative • Like talking at a party • Suppose one computer wants to send to another on the wire How to send? Introduction to computing principles Network
Network TCP/IP WWW E-Mail Multiple Computers - Ethernet LAN Design • How to send: • Every computer has a unique address on the wire • Packet includes to:addr of recipient • Sender waits for period of silence on the wire, sends packet • Packet spreads out on wire, reaching all computers - "broadcast” • Receive: • All computers listen to the wire all the time • Pick out packets addressed to them, ignore other packets • Insecure - it's a broadcast, everybody hears everything • later we‘ll add encryption ( 加密 ) Introduction to computing principles Network
Network TCP/IP WWW E-Mail Ethernet Collision ( 以太网冲突 ) • "Collision" happens in rare cases • Two computers transmit at the same time • Data collides on the wire • Senders notice the collision, stop sending • Both senders wait a random amount of time, then try again Introduction to computing principles Network
Network TCP/IP WWW E-Mail Wi-Fi: Same Strategy • Wi-Fi wireless networking • Similar strategy to Ethernet (simplifying) • Every computer has a radio • The radio-channel used is the shared medium • One computer transmits at a time, Everyone listens Introduction to computing principles Network
Network TCP/IP WWW E-Mail Wi-Fi Scenarios • Bad guy intercepts packets intended for others: • Don't ignore packets to: someone else • This is why we have encryption (https - a later lecture) • Someone on the LAN is downloading a big file, what happens? • The shared radio channel is busy with their packets (i.e. not silent) • Fewer opportunities for everyone else to use it • Computer receives a packet but the checksum does not match • The packet was corrupted in transit • In effect, request that a second copy be sent Introduction to computing principles Network
Network TCP/IP WWW E-Mail Ethernet/Wi-Fi Design Summary • Shared: there's only one wire/channel and everybody uses it • Distributed and Collaborative: no central control, each computer following the collaborative protocol in good faith • Insecure: not to hard to listen and pick up packets not intended for you • Performance degrades, but does not break as more computers use the shared medium • strategy : getting great Incredibly successful design performance out of minimal hardware • These design themes recur in the greater internet Introduction to computing principles Network
Network TCP/IP WWW E-Mail Megabits Math • Speed of an internet connection • “megabits per second”: millions of bits per second • aka "mbps” • A typical LAN speed: 100 megabits per second (wired or wireless) • Slow home internet connection is maybe 1 megabit • Fast home internet is 10 megabits or more • Local LAN speed is the fastest • The "upstream" internet connection speed is typically slower Introduction to computing principles Network
Network TCP/IP WWW E-Mail Networking Math • Recall 1500 byte/packet, 1500 * 8 = 12000 bits • Q1: How seconds required to send 1500 byte packet on 100 megabit network? = 12000 / 100 million = 0.00012 (second) • Q2: How many megabytes per second can our 100 megabit connection send? =100/8 = 12.5 (megabytes) • Q3: I have a 38 MB image. How long to send? =38/12.5=3.04 (second) • Q4: How many packages for a 38 MB image? • Caveat: For this course, we'll compute the "ideal" speed. In reality, networking has a lot of overhead + possible sharing, actual obtained speed might be 20-50% less. Introduction to computing principles Network
Network TCP/IP WWW E-Mail How The Internet Came About - Standards • Internet is about interoperation • Standards are what make the internet work • The internet is an incredible advance Introduction to computing principles Network
Network TCP/IP WWW E-Mail First Example - Email Standard • Standards are about "interoperability": • Operation between parties • Standard • -Interoperation between parties • -Not tied to a single vendor • Email is a great example • 1. Standard address form: ****@tju.edu.cn • 2. Standard email protocol: email accounts can send each other email Introduction to computing principles Network
Network TCP/IP WWW E-Mail • You don‘t need a tju.edu.cn account to send ****@tju.edu.cn mail • You don't need a gmail account to send email to someone with a gmail account • Any email account can contact any other • Downside: spam • Phone numbers another example standard: 86-022- 27406538 Introduction to computing principles Network
Network TCP/IP WWW E-Mail Chat Systems - Lack of Standards • "it just works" standards is not the common state • Easy to get in the "babel" state • Each vendor wants works with itself • Utility for users and vendors is terrible • Each vendor pursuing its interest, hard to get out of the babel state Introduction to computing principles Network
Network TCP/IP WWW E-Mail Exercise: How Many Chat Systems How many different chat systems can you list? • This is not a good system! • How do you contact someone? • Each system has its own address scheme • Each person has a confusion of their own addresses • One benefit: each system can prioritize certain features Introduction to computing principles Network
Network TCP/IP WWW E-Mail Babel Analysis - Bad • What we had pre-internet • Each vendor has its own system • Vendors tend to like "lock-in" where it's hard for clients to leave - e.g. your address book is stuck in the system • Format-a to Format-b "adapter" for each pair .. Awkward • Requires on the order n-squared such adapters • Babel: easy to get stuck here, not efficient - e.g. Chat Introduction to computing principles Network
Network TCP/IP WWW E-Mail Introduction to computing principles Network
Network TCP/IP WWW E-Mail Escape From Babel - Standards Introduction to computing principles Network
Recommend
More recommend