Unformatted text preview:

inst eecs berkeley edu cs61c CS61C Machine Structures Lecture 37 Input Output Review Virtual memory to Physical Memory Translation too slow Add a cache of Virtual to Physical Address Translations called a TLB Lecturer PSOE Dan Garcia www cs berkeley edu ddgarcia Email poses threat to IQ UK researchers have found a link between the distractions of workrelated email usage and lower IQ scores The IQ drops were up to 10 points which compares to only 4 points from weed Spatial Locality means Working Set of Pages is all that must be in memory for process to run fairly well Virtual Memory allows protected sharing of memory between processes with less swapping to disk www cnn com 2005 WORLD europe 04 22 text iq CS61C L37 I O 1 Garcia Fall 2004 U CB Recall 5 components of any Computer Earlier Lectures Current Lectures Computer Processor Memory active passive Control brain where programs Datapath data live brawn when running Devices Input Output Keyboard Mouse Disk Network Display Printer Garcia Fall 2004 U CB I O Speed bytes transferred per second from mouse to Gigabit LAN 10 million to 1 Partner Keyboard Input Mouse Input Voice output Output Floppy disk Storage Laser Printer Output Magnetic Disk Storage Wireless Network I or O Graphics Display Output Wired LAN Network I or O Human Human Human Machine Human Machine Machine Human Machine Motivation for Input Output I O is how humans interact with computers I O gives computers long term memory Read pressure of synthetic hand and control synthetic arm and hand of fireman Control propellers fins communicate in BOB Breathable Observable Bubble Computer without I O like a car without wheels great technology but won t get you anywhere CS61C L37 I O 4 Data Rate KBytes s 0 01 0 02 5 00 50 00 100 00 10 000 00 10 000 00 30 000 00 125 000 00 A way to connect many types of devices to the Proc Mem A way to control these devices respond to them and transfer data Garcia Fall 2004 U CB Files APIs Operating System Proc Mem PCI Bus A way to present them to user programs so they are useful SCSI Bus cmd reg data reg When discussing transfer rates use 10x CS61C L37 I O 5 Garcia Fall 2004 U CB What do we need to make I O work I O Device Examples and Speeds Behavior Garcia Fall 2004 U CB I O lets computers do amazing things CS61C L37 I O 3 Device CS61C L37 I O 2 CS61C L37 I O 6 Garcia Fall 2004 U CB Instruction Set Architecture for I O Memory Mapped I O What must the processor do for I O Certain addresses are not regular memory Input reads a sequence of bytes Output writes a sequence of bytes Some processors have special input and output instructions Alternative model used by MIPS Use loads for input stores for output Called Memory Mapped Input Output A portion of the address space dedicated to communication paths to Input or Output devices no memory there CS61C L37 I O 7 Garcia Fall 2004 U CB Processor I O Speed Mismatch 1GHz microprocessor can execute 1 billion load or store instructions per second or 4 000 000 KB s data rate I O devices data rates range from 0 01 KB s to 125 000 KB s Input device may not be ready to send data as fast as the processor loads it Also might be waiting for human to act Output device not be ready to accept data as fast as processor stores it What to do CS61C L37 I O 9 Garcia Fall 2004 U CB SPIM I O Simulation SPIM simulates 1 I O device memorymapped terminal keyboard display Read from keyboard receiver 2 device regs Writes to terminal transmitter 2 device regs CS61C L37 I O 11 Unused 00 00 Unused 00 00 Received Byte Unused 00 00 Unused Ready I E Transmitter Control 0xffff0008 Transmitter Data 0xffff000c IE Ready I E Receiver Control 0xffff0000 Receiver Data 0xffff0004 Transmitted Byte Garcia Fall 2004 U CB Instead they correspond to registers in I O devices address 0xFFFFFFFF 0xFFFF0000 cntrl reg data reg 0 CS61C L37 I O 8 Garcia Fall 2004 U CB 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 L37 I O 10 Garcia Fall 2004 U CB 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 L37 I O 12 Garcia Fall 2004 U CB I O Example Input Read from keyboard into v0 Waitloop lui lw andi beq lw t0 0xffff ffff0000 t1 0 t0 control t1 t1 0x1 t1 zero Waitloop v0 4 t0 data Mouse polled 30 times sec so as not to miss user movement Output Write to display from a0 Waitloop lui lw andi beq sw t0 0xffff ffff0000 t1 8 t0 control t1 t1 0x1 t1 zero Waitloop a0 12 t0 data Processor waiting for I O called Polling Ready bit from processor s point of view CS61C L37 I O 13 Cost of Polling Assume for a processor with a 1GHz clock it takes 400 clock cycles for a polling operation call polling routine accessing the device and returning Determine of processor time for polling Garcia Fall 2004 U CB Processor time to poll p 677 in book Floppy disk transfers data in 2 Byte units and has a data rate of 50 KB second No data transfer can be missed Hard disk transfers data in 16 Byte chunks and can transfer at 16 MB second Again no transfer can be missed CS61C L37 I O 15 Garcia Fall 2004 U CB Processor time to poll hard disk Mouse Polling Clocks sec 30 polls s 400 clocks poll 12K clocks s Frequency of Polling Disk 16 MB s 16 B 1M polls s Processor for polling 12 103 clocks s 1 109 clocks s 0 0012 Polling mouse little impact on processor Disk Polling Clocks sec 1M polls s 400 clocks poll 400M clocks s Frequency of Polling Floppy 50 KB s 2 B poll 25K polls s Processor for polling Floppy Polling Clocks sec 25K polls s 400 clocks poll 10M clocks s Processor for polling 400 106 clocks s 1 109 clocks s 40 Unacceptable 10 106 clocks s …


View Full Document

Berkeley COMPSCI 61C - Lecture Notes

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?