CS61C L27 I/O & Networks (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #27 I/O.

Slides:



Advertisements
Similar presentations
Data Communications System By Ajarn Preecha Pangsuban.
Advertisements

Network Layer and Transport Layer.
CS61C L38 I/O : Networks (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L39 I/O : Networks (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 36: IO Basics Instructor: Dan Garcia
CS61C L36 I/O : Networks (1) Iyengar © UCB TA Sameer “The Yellow Dart” Iyengar inst.eecs/~cs61c-ti inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L36 Input / Output (1) Garcia, Spring 2007 © UCB Robson disk $  Intel has a NAND flash-based disk cache which can speed up access for laptops and.
CS 61C L40 I/O Networks (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 34 – Input / Output “Arduino is an open-source electronics prototyping.
CS 430 – Computer Architecture 1 CS 430 – Computer Architecture Input/Output: Polling and Interrupts William J. Taffe using the slides of David Patterson.
CS 61C L26 Disks & Networks (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #26: Disks & Networks.
CS61C L18 Introduction to CPU Design (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
CS430 Computer Architecture 1 CS430 Computer Architecture --Networks-- William J. Taffe using the slides of David Patterson.
CS61C L24 Input/Output, Networks I (1) Garcia, Fall 2005 © UCB Lecturer PSOE, new dad Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS61C L15 Networks © UC Regents 1 CS61C - Machine Structures Lecture 15 - Networks October 18, 2000 David Patterson
Introduction to Management Information Systems Chapter 5 Data Communications and Internet Technology HTM 304 Fall 07.
1 Lecture 24: Interconnection Networks Topics: communication latency, centralized and decentralized switches (Sections 8.1 – 8.5)
CS61C L36 I/O : Networks (1) Zimmer © UCB TA Brian Zimmer inst.eecs/~cs61c-th inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 36 I/O.
CS 61C L39 I/O (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L37 I/O (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
CS61C L15 Synchronous Digital Systems (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
CS61C L37 I/O : Networks (1) Kronrod © UCB TA Alex Kronrod inst.eecs/~cs61c-te inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 37 I/O.
COMPUTER NETWORKS.
 The Open Systems Interconnection model (OSI model) is a product of the Open Systems Interconnection effort at the International Organization for Standardization.
Process-to-Process Delivery:
CS61C L36 I/O : Networks (1) Garcia © UCB Senior Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
Chapter 2 The Infrastructure. Copyright © 2003, Addison Wesley Understand the structure & elements As a business student, it is important that you understand.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 38: IO and Networking Instructor: Dan Garcia
3/11/2002CSE Input/Output Input/Output Control Datapath Memory Processor Input Output Memory Input Output Network Control Datapath Processor.
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
Protocol Layering Chapter 10. Looked at: Architectural foundations of internetworking Architectural foundations of internetworking Forwarding of datagrams.
Input and Output Computer Organization and Assembly Language: Module 9.
1 The Internet and Networked Multimedia. 2 Layering  Internet protocols are designed to work in layers, with each layer building on the facilities provided.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_b Protocol Layering Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof.
UNDERSTANDING THE HOST-TO-HOST COMMUNICATIONS MODEL - OSI LAYER & TCP/IP MODEL 1.
MODULE I NETWORKING CONCEPTS.
Internetworking Internet: A network among networks, or a network of networks Allows accommodation of multiple network technologies Universal Service Routers.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 13.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Lecture (Mar 23, 2000) H/W Assignment 3 posted on Web –Due Tuesday March 28, 2000 Review of Data packets LANS WANS.
Networking Basics CCNA 1 Chapter 11.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
Lecture 4 Overview. Ethernet Data Link Layer protocol Ethernet (IEEE 802.3) is widely used Supported by a variety of physical layer implementations Multi-access.
Network Technologies Definitions –Network: physical connection that allows two computers to communicate –Packet: a unit of transfer »A sequence of bits.
S305 – Network Infrastructure Chapter 5 Network and Transport Layers.
CS2100 Computer Organisation Input/Output – Own reading only (AY2015/6) Semester 1 Adapted from David Patternson’s lecture slides:
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 37: IO Basics Instructor: Dan Garcia
Networks Network Components. Learning Objectives Describe different media for transmitting data and their carrying capabilities. Explain the different.
CS10 L17 Internet II (1) Garcia © UCB Senior Lecturer SOE Dan Garcia cs10.berkeley.edu CS10 : Beauty and Joy of Computing.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IT 251 Computer Organization and Architecture
IT 251 Computer Organization and Architecture
Operating Systems (CS 340 D)
Topic 5: Communication and the Internet
CS61C Anatomy of I/O Devices: Networks Lecture 14
Process-to-Process Delivery:
Practical Issues for Commercial Networks
CDA-5155 Computer Architecture Principles Fall 2000
OSI Reference Model Unit II
Process-to-Process Delivery: UDP, TCP
OSI Model 7 Layers 7. Application Layer 6. Presentation Layer
Presentation transcript:

CS61C L27 I/O & Networks (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #27 I/O Basics & Networking Sun Releases New Processor 64 Threads in 1 Package!!

CS61C L27 I/O & Networks (2) Beamer, Summer 2007 © UCB What do we need to make I/O work? A way to present them to user programs so they are useful cmd reg. data reg. Operating System APIsFiles Proc Mem A way to connect many types of devices to the Proc-Mem PCI Bus SCSI Bus A way to control these devices, respond to them, and transfer data

CS61C L27 I/O & Networks (3) Beamer, Summer 2007 © UCB Memory Mapped I/O Certain addresses are not regular memory Instead, they correspond to registers in I/O devices cntrl reg. data reg. 0 0xFFFFFFFF 0xFFFF0000 address

CS61C L27 I/O & Networks (4) Beamer, Summer 2007 © UCB Processor Checks Status before Acting Path to device generally has 2 registers: Control Register, says it’s OK to read/write (I/O ready) [think of a flagman on a road] Data Register, contains data Processor reads from Control Register in loop, waiting for device to set Ready bit in Control reg (0  1) to say its OK Processor then loads from (input) or writes to (output) data register Load from or Store into Data Register resets Ready bit (1  0) of Control Register

CS61C L27 I/O & Networks (5) Beamer, Summer 2007 © UCB SPIM I/O Simulation SPIM simulates 1 I/O device: memory- mapped terminal (keyboard + display) Read from keyboard (receiver); 2 device regs Writes to terminal (transmitter); 2 device regs Received Byte Receiver Data 0xffff0004 Unused ( ) (IE) Receiver Control 0xffff0000 Ready (I.E.) Unused ( ) Transmitted Byte Transmitter Control 0xffff0008 Transmitter Data 0xffff000c Ready (I.E.) Unused ( ) Unused

CS61C L27 I/O & Networks (6) Beamer, Summer 2007 © UCB SPIM I/O Control register rightmost bit (0): Ready Receiver: Ready==1 means character in Data Register not yet been read; 1  0 when data is read from Data Reg Transmitter: Ready==1 means transmitter is ready to accept a new character; 0  Transmitter still busy writing last char -I.E. bit discussed later Data register rightmost byte has data Receiver: last char from keyboard; rest = 0 Transmitter: when write rightmost byte, writes char to display

CS61C L27 I/O & Networks (7) Beamer, Summer 2007 © UCB I/O Example Input: Read from keyboard into $v0 lui$t0, 0xffff #ffff0000 Waitloop:lw$t1, 0($t0) #control andi$t1,$t1,0x1 beq$t1,$zero, Waitloop lw$v0, 4($t0) #data Output: Write to display from $a0 lui$t0, 0xffff #ffff0000 Waitloop:lw$t1, 8($t0) #control andi$t1,$t1,0x1 beq$t1,$zero, Waitloop sw$a0, 12($t0) #data Processor waiting for I/O called “Polling” “Ready” bit is from processor’s point of view!

CS61C L27 I/O & Networks (8) Beamer, Summer 2007 © UCB What is the alternative to polling? Wasteful to have processor spend most of its time “spin-waiting” for I/O to be ready Would like an unplanned procedure call that would be invoked only when I/O device is ready Solution: use exception mechanism to help I/O. Interrupt program when I/O ready, return when done with data transfer

CS61C L27 I/O & Networks (9) Beamer, Summer 2007 © UCB I/O Interrupt An I/O interrupt is like overflow exceptions except: An I/O interrupt is “asynchronous” More information needs to be conveyed An I/O interrupt is asynchronous with respect to instruction execution: I/O interrupt is not associated with any instruction, but it can happen in the middle of any given instruction I/O interrupt does not prevent any instruction from completion

CS61C L27 I/O & Networks (10) Beamer, Summer 2007 © UCB Interrupt-Driven Data Transfer (1) I/O interrupt (2) save PC Memory add sub and or user program read store... jr interrupt service routine (3) jump to interrupt service routine (4) perform transfer (5)

CS61C L27 I/O & Networks (11) Beamer, Summer 2007 © UCB SPIM I/O Simulation: Interrupt Driven I/O I.E. stands for Interrupt Enable Set Interrupt Enable bit to 1 have interrupt occur whenever Ready bit is set Received Byte Receiver Data 0xffff0004 Unused ( ) (IE) Receiver Control 0xffff0000 Ready (I.E.) Unused ( ) Transmitted Byte Transmitter Control 0xffff0008 Transmitter Data 0xffff000c Ready (I.E.) Unused ( ) Unused

CS61C L27 I/O & Networks (12) Beamer, Summer 2007 © UCB Peer Instruction A. A faster CPU will result in faster I/O. B. Hardware designers handle mouse input with interrupts since it is better than polling in almost all cases. C. Low-level I/O is actually quite simple, as it’s really only reading and writing bytes. ABC 0: FFF 1: FFT 2: FTF 3: FTT 4: TFF 5: TFT 6: TTF 7: TTT

CS61C L27 I/O & Networks (13) Beamer, Summer 2007 © UCB Peer Instruction Answer A. A faster CPU will result in faster I/O. B. Hardware designers handle mouse input with interrupts since it is better than polling in almost all cases. C. Low-level I/O is actually quite simple, as it’s really only reading and writing bytes. F A L S E T R U E A. Less sync data idle time B. Because mouse has low I/O rate polling often used C. Concurrency, device requirements vary! F A L S E ABC 0: FFF 1: FFT 2: FTF 3: FTT 4: TFF 5: TFT 6: TTF 7: TTT

CS61C L27 I/O & Networks (14) Beamer, Summer 2007 © UCB “And in early conclusion…” I/O gives computers their 5 senses I/O speed range is 100-million to one Processor speed means must synchronize with I/O devices before use Polling works, but expensive processor repeatedly queries devices Interrupts works, more complex devices causes an exception, causing OS to run and deal with the device I/O control leads to Operating Systems

CS61C L27 I/O & Networks (15) Beamer, Summer 2007 © UCB Administrivia Assignments Proj4 due 8/12 HW8 due 8/14 Final Review Session probable on Monday Course Survey during last lecture 2 points extra added for taking survey (still anonymous) Grading done for HW1-4 & Proj1

CS61C L27 I/O & Networks (16) Beamer, Summer 2007 © UCB Why Networks? Originally sharing I/O devices between computers ex: printers Then communicating between computers ex: file transfer protocol Then communicating between people ex: Then communicating between networks of computers ex: file sharing, www, …

CS61C L27 I/O & Networks (17) Beamer, Summer 2007 © UCB How Big is the Network (2007)? in 273 Soda in inst.cs.berkeley.edu in eecs & cs.berkeley.edu in berkeley.edu in.edu (2005: ~9,000,000) in US (2005: ~217,000,000, 2006: ~286.5E6) (.net.com.edu.arpa.us.mil.org.gov) in the world Source: Internet Software Consortium: ~30 ~525 ~6,400 (1999) ~50,000 ~10,000,000 ~258,941,310 ~433,190,000 (2005:~317,000,000, 2006: ~439,000,000)

CS61C L27 I/O & Networks (18) Beamer, Summer 2007 © UCB Growth Rate Ethernet Bandwidth mb/s mb/s mb/s mb/s Gig E en.wikipedia.org/wiki/10_gigabit_ethernet

CS61C L27 I/O & Networks (19) Beamer, Summer 2007 © UCB Shared vs. Switched Based Networks Shared vs. Switched: Switched: pairs (“point-to- point” connections) communicate at same time Shared: 1 at a time (CSMA/CD) Aggregate bandwidth (BW) in switched network is many times shared: point-to-point faster since no arbitration, simpler interface Node Shared Crossbar Switch Node

CS61C L27 I/O & Networks (20) Beamer, Summer 2007 © UCB What makes networks work? links connecting switches to each other and to computers or devices Computer network interface switch ability to name the components and to route packets of information - messages - from a source to a destination Layering, redundancy, protocols, and encapsulation as means of abstraction (61C big idea)

CS61C L27 I/O & Networks (21) Beamer, Summer 2007 © UCB Typical Types of Networks Local Area Network (Ethernet) Inside a building: Up to 1 km (peak) Data Rate: 10 Mbits/sec, 100 Mbits /sec,1000 Mbits/sec (1.25, 12.5, 125 MBytes/s) Run, installed by network administrators Wide Area Network Across a continent (10km to km) (peak) Data Rate: 1.5 Mb/s to Mb/s Run, installed by telecommunications companies (Sprint, UUNet[MCI], AT&T) Wireless Networks (LAN),...

CS61C L27 I/O & Networks (22) Beamer, Summer 2007 © UCB The Sprint U.S. Topology (2001)

CS61C L27 I/O & Networks (23) Beamer, Summer 2007 © UCB ABCs of Networks: 2 Computers Starting Point: Send bits between 2 computers Queue (First In First Out) on each end Can send both ways (“Full Duplex”) One-way information is called “Half Duplex” Information sent called a “message” Note: Messages also called packets network interface device OS app OS app

CS61C L27 I/O & Networks (24) Beamer, Summer 2007 © UCB A Simple Example: 2 Computers What is Message Format? Similar idea to Instruction Format Fixed size? Number bits? Header (Trailer): information to deliver message Payload: data in message What can be in the data? anything that you can represent as bits values, chars, commands, addresses... 8 bit 32 x Length bits Data Length

CS61C L27 I/O & Networks (25) Beamer, Summer 2007 © UCB Questions About Simple Example What if more than 2 computers want to communicate? Need computer “address field” in packet to know: -which computer should receive it (destination) -which computer to reply to (source) Just like envelopes! 8 bits 32*n bits 8 bits HeaderPayload CMD/ Address /DataNet ID Dest.Source Len

CS61C L27 I/O & Networks (26) Beamer, Summer 2007 © UCB ABCs: many computers switches and routers interpret the header in order to deliver the packet source encodes and destination decodes content of the payload network interface device OS application OS application

CS61C L27 I/O & Networks (27) Beamer, Summer 2007 © UCB Questions About Simple Example What if message is garbled in transit? Add redundant information that is checked when message arrives to be sure it is OK 8-bit sum of other bytes: called “Check sum”; upon arrival compare check sum to sum of rest of information in message. xor also popular. HeaderPayload Checksum Trailer CMD/ Address /Data Net ID Len Learn about Checksums in Math 55/CS 70…

CS61C L27 I/O & Networks (28) Beamer, Summer 2007 © UCB Questions About Simple Example What if message never arrives? Receiver tells sender when it arrives Send an ACK (ACKnowledgement) [like registered mail] Sender retries if waits too long Don’t discard message until it is ACK’ed If check sum fails, don’t send ACK HeaderPayload Checksum Trailer CMD/ Address /Data Net ID Len ACK INFO

CS61C L27 I/O & Networks (29) Beamer, Summer 2007 © UCB Observations About Simple Example Simple questions (like those on the previous slides) lead to: more complex procedures to send/receive message more complex message formats Protocol: algorithm for properly sending and receiving messages (packets) …an agreement on how to communicate

CS61C L27 I/O & Networks (30) Beamer, Summer 2007 © UCB Software Protocol to Send and Receive SW Send steps 1: Application copies data to OS buffer 2: OS calculates checksum, starts timer 3: OS sends data to network interface HW and says start SW Receive steps 3: OS copies data from network interface HW to OS buffer 2: OS calculates checksum, if OK, send ACK; if not, delete message (sender resends when timer expires) 1: If OK, OS copies data to user address space, & signals application to continue

CS61C L27 I/O & Networks (31) Beamer, Summer 2007 © UCB Abstraction to cope with complexity of communication Networks are like onions Hierarchy of layers: -Application (chat client, game, etc.) -Transport (TCP, UDP) -Network (IP) -Physical Link (wired, wireless, etc.) Protocol for Networks of Networks? Networks are like onions. They stink? Yes. No! Oh, they make you cry. No!… Layers. Onions have layers. Networks have layers.

CS61C L27 I/O & Networks (32) Beamer, Summer 2007 © UCB Protocol Family Concept Message TH TH THTH Actual Physical MessageTH TH Actual Logical

CS61C L27 I/O & Networks (33) Beamer, Summer 2007 © UCB Protocol Family Concept Key to protocol families is that communication occurs logically at the same level of the protocol, called peer-to- peer… …but is implemented via services at the next lower level Encapsulation: carry higher level information within lower level “envelope” Fragmentation: break packet into multiple smaller packets and reassemble

CS61C L27 I/O & Networks (34) Beamer, Summer 2007 © UCB Protocol for Network of Networks IP: Best-Effort Packet Delivery (Network Layer) Packet switching Send data in packets Header with source & destination address “Best effort” delivery Packets may be lost Packets may be corrupted Packets may be delivered out of order

CS61C L27 I/O & Networks (35) Beamer, Summer 2007 © UCB Protocol for Network of Networks Transmission Control Protocol/Internet Protocol (TCP/IP) (TCP :: a Transport Layer) This protocol family is the basis of the Internet, a WAN protocol IP makes best effort to deliver TCP guarantees delivery TCP/IP so popular it is used even when communicating locally: even across homogeneous LAN

CS61C L27 I/O & Networks (36) Beamer, Summer 2007 © UCB Message TCP/IP packet, Ethernet packet, protocols Application sends message TCP data TCP Header IP Header IP Data EH Ethernet Hdr TCP breaks into 64KiB segments, adds 20B header IP adds 20B header, sends to network If Ethernet, broken into 1500B packets with headers, trailers (24B) All Headers, trailers have length field, destination,...

CS61C L27 I/O & Networks (37) Beamer, Summer 2007 © UCB TCP/IP in action Creating a Packet: TCP IP Header TCP Header

CS61C L27 I/O & Networks (38) Beamer, Summer 2007 © UCB Overhead vs. Bandwidth Networks are typically advertised using peak bandwidth of network link: e.g., 100 Mbits/sec Ethernet (“100 base T”) Software overhead to put message into network or get message out of network often limits useful bandwidth Assume overhead to send and receive = 320 microseconds (  s), want to send 1000 Bytes over “100 Mbit/s” Ethernet Network transmission time: 1000Bx8b/B /100Mb/s = 8000b / (100b/  s) = 80  s Effective bandwidth: 8000b/(320+80)  s = 20 Mb/s

CS61C L27 I/O & Networks (39) Beamer, Summer 2007 © UCB And in conclusion… Protocol suites allow networking of heterogeneous components Another form of principle of abstraction Protocols  operation in presence of failures Standardization key for LAN, WAN Integrated circuit (“Moore’s Law”) revolutionizing network switches as well as processors Switch just a specialized computer Trend from shared to switched networks to get faster links and scalable bandwidth Interested? -EE122 (CS-based in Fall, EE –based in Spring)

CS61C L27 I/O & Networks (40) Beamer, Summer 2007 © UCB [Bonus] Example: Network Media Copper, 1mm think, twisted to avoid antenna effect Twisted Pair (“Cat 5”): Light: 3 parts are cable, light source, light detector Fiber Optics Transmitter Is L.E.D or Laser Diode Receiver – Photodiode light source Silica: glass or plastic; actually < 1/10 diameter of copper Total internal reflection Air Cladding Buffer

CS61C L27 I/O & Networks (41) Beamer, Summer 2007 © UCB [Bonus] Backbone Link App Composition File-sharing is the dominant application on many links!