CS 61C: Great Ideas in Computer Architecture (Machine Structures) More I/O: DMA Vladimir Stojanovic & Nicholas Weaver

Slides:



Advertisements
Similar presentations
Professor Michael J. Losacco CIS 1110 – Using Computers Storage Chapter 6.
Advertisements

Agenda Types of Storage Media Semiconductor ROM and RAM Magnetic Tapes, Floppy Disks, and Hard Disks Optical CS C446 Data Storage Technologies & Networks.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
SECTIONS 13.1 – 13.3 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin SECONDARY STORAGE MANAGEMENT.
CPSC-608 Database Systems Fall 2009 Instructor: Jianer Chen Office: HRBB 309B Phone: Notes #5.
Computer-System Structures
12/3/2004EE 42 fall 2004 lecture 391 Lecture #39: Magnetic memory storage Last lecture: –Dynamic Ram –E 2 memory This lecture: –Future memory technologies.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
SECTIONS 13.1 – 13.3 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin SECONDARY STORAGE MANAGEMENT.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
Chapter 2: Computer-System Structures
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 39: IO Disks Instructor: Dan Garcia 1.
Passage Three Storage Devices. Training target: In this part , you should try your best to form good reading habits. In order to avoid your ill habits.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Lecture on Electronic Memories. What Is Electronic Memory? Electronic device that stores digital information Types –Volatile v. non-volatile –Static v.
Lecture 11: DMBS Internals
Physical Storage and File Organization COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
1 Secondary Storage Management Submitted by: Sathya Anandan(ID:123)
Your Interactive Guide to the Digital World Discovering Computers 2012.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
STORAGE DEVICES Presentation By: Saurabh Mishra. A data storage device is a device for recording (storing) information (data). CD, Hard Disk and Flash.
2.1 Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General.
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Copyright © Curt Hill Disk Basics Structure and Characteristics of Secondary Storage.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
Memory The term memory is referred to computer’s main memory, or RAM (Random Access Memory). RAM is the location where data and programs are stored (temporarily),
DMBS Internals I February 24 th, What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the.
Jeffrey Ellak CS 147. Topics What is memory hierarchy? What are the different types of memory? What is in charge of accessing memory?
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Magnetic Disk Rotational latency Example Find the average rotational latency if the disk rotates at 20,000 rpm.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
COSC 6340: Disks 1 Disks and Files DBMS stores information on (“hard”) disks. This has major implications for DBMS design! » READ: transfer data from disk.
1 Lecture 16: Data Storage Wednesday, November 6, 2006.
CS 110 Computer Architecture Lecture 24: More I/O: DMA, Disks, Networking Instructor: Sören Schwertfeger School of Information.
1 Components of the Virtual Memory System  Arrows indicate what happens on a lw virtual address data physical address TLB page table memory cache disk.
Data Storage and Querying in Various Storage Devices.
File organization Secondary Storage Devices Lec#7 Presenter: Dr Emad Nabil.
Computer System Structures Storage
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Database Management Systems (CS 564)
Backing Store.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
CHAPTER 4 Memory System Organization and Architecture
Disks and Files DBMS stores information on (“hard”) disks.
Computer Architecture
Lecture 11: DMBS Internals
Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin
Secondary Storage Devices
Computer-System Architecture
Module 2: Computer-System Structures
GCSE OCR 4 Storage Computer Science J276 Unit 1
Computer Application Waseem Gulsher
Persistence: I/O devices
Module 2: Computer-System Structures
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

CS 61C: Great Ideas in Computer Architecture (Machine Structures) More I/O: DMA Vladimir Stojanovic & Nicholas Weaver 1

Review: I/O “Memory mapped I/O”: Device control/data registers mapped to CPU address space CPU synchronizes with I/O device: – Polling – Interrupts “Programmed I/O”: – CPU execs lw/sw instructions for all data movement to/from devices – CPU spends time doing 2 things: 1.Getting data from device to main memory 2.Using data to compute 2

Working with real devices “Memory mapped I/O”: Device control/data registers mapped to CPU address space CPU synchronizes with I/O device: – Polling – Interrupts “Programmed I/O”: DMA – CPU execs lw/sw instructions for all data movement to/from devices – CPU spends time doing 2 things: 1.Getting data from device to main memory 2.Using data to compute 3

Agenda Direct Memory Access (DMA) Disks 4

What’s wrong with Programmed I/O? Not ideal because … 1.CPU has to execute all transfers, could be doing other work 2.Device speeds don’t align well with CPU speeds 3.Energy cost of using beefy general-purpose CPU where simpler hardware would suffice Until now CPU has sole control of main memory 5

PIO vs. DMA 6

Direct Memory Access (DMA) Allows I/O devices to directly read/write main memory New Hardware: the DMA Engine DMA engine contains registers written by CPU: – Memory address to place data – # of bytes – I/O device #, direction of transfer – unit of transfer, amount to transfer per burst 7

Operation of a DMA Transfer 8 [From Section Direct Memory Access in Modern Operating Systems by Andrew S. Tanenbaum, Herbert Bos, 2014]

DMA: Incoming Data 1.Receive interrupt from device 2.CPU takes interrupt, begins transfer – Instructs DMA engine/device to place certain address 3.Device/DMA engine handle the transfer – CPU is free to execute other things 4.Upon completion, Device/DMA engine interrupt the CPU again 9

DMA: Outgoing Data 1.CPU decides to initiate transfer, confirms that external device is ready 2.CPU begins transfer – Instructs DMA engine/device that data is certain address 3.Device/DMA engine handle the transfer – CPU is free to execute other things 4.Device/DMA engine interrupt the CPU again to signal completion 10

DMA: Some new problems Where in the memory hierarchy do we plug in the DMA engine? Two extremes: – Between L1 and CPU: Pro: Free coherency Con: Trash the CPU’s working set with transferred data – Between Last-level cache and main memory: Pro: Don’t mess with caches Con: Need to explicitly manage coherency 11

DMA: Some new problems How do we arbitrate between CPU and DMA Engine/Device access to memory? Three options: – Burst Mode Start transfer of data block, CPU cannot access memory in the meantime – Cycle Stealing Mode DMA engine transfers a byte, releases control, then repeats - interleaves processor/DMA engine accesses – Transparent Mode DMA transfer only occurs when CPU is not using the system bus 12

Agenda Direct Memory Access (DMA) Disks 13

Computer Memory Hierarchy 14 Today

Magnetic Disk – common I/O device A kind of computer memory – Information stored by magnetizing ferrite material on surface of rotating disk Similar to tape recorder except digital rather than analog data A type of non-volatile storage – Retains its value without applying power to disk. Two Types of Magnetic Disk 1.Hard Disk Drives (HDD) – faster, more dense, non-removable. 2.Floppy disks – slower, less dense, removable (now replaced by USB “flash drive”). Purpose in computer systems (Hard Drive): 1.Working file system + long-term backup for files 2.Secondary “backing store” for main-memory. Large, inexpensive, slow level in the memory hierarchy (virtual memory) 15

Photo of Disk Head, Arm, Actuator Arm Head Spindle 16

Disk Device Terminology Several platters, with information recorded magnetically on both surfaces (usually) Bits recorded in tracks, which in turn divided into sectors (e.g., 512 Bytes) Actuator moves head (end of arm) over track (“seek”), wait for sector rotate under head, then read or write Outer Track Inner Track Sector Actuator HeadArm Platter 17 Video of hard disk in action

Hard Drives are Sealed. Why? The closer the head to the disk, the smaller the “spot size” and thus the denser the recording. – Measured in Gbit/in^2 – ~900 Gbit/in^2 is state of the art – Started out at 2 Kbit/in^2 – ~450,000,000x improvement in ~60 years Disks are sealed to keep the dust out. – Heads are designed to “fly” at around 3-20nm above the surface of the disk. – % of the head/arm weight is supported by the air bearing force (air cushion) developed between the disk and the head nm

Disk Device Performance (1/2) Disk Access Time = Seek Time + Rotation Time + Transfer Time + Controller Overhead – Seek Time = time to position the head assembly at the proper cylinder – Rotation Time = time for the disk to rotate to the point where the first sectors of the block to access reach the head – Transfer Time = time taken by the sectors of the block and any gaps between them to rotate past the head Platter Arm Actuator Head Sector Inner Track Outer Track Controller Spindle 19

Disk Device Performance (2/2) Average values to plug into the formula: Rotation Time: Average distance of sector from head? – 1/2 time of a rotation 7200 Revolutions Per Minute  120 Rev/sec 1 revolution = 1/120 sec  8.33 milliseconds 1/2 rotation (revolution)  4.17 ms Seek time: Average no. tracks to move arm? – Number of tracks/3 (see CS186 for the math) – Then, seek time = number of tracks moved × time to move across one track 20

But wait! Performance estimates are different in practice: Many disks have on-disk caches, which are completely hidden from the outside world – Previous formula completely replaced with on- disk cache access time 21

Where does Flash memory come in? ~10 years ago: Microdrives and Flash memory (e.g., CompactFlash) went head-to-head – Both non-volatile (retains contents without power supply) – Flash benefits: lower power, no crashes (no moving parts, need to spin µdrives up/down) – Disk cost = fixed cost of motor + arm mechanics, but actual magnetic media cost very low – Flash cost = most cost/bit of flash chips – Over time, cost/bit of flash came down, became cost competitive 22

Flash Memory / SSD Technology NMOS transistor with an additional conductor between gate and source/drain which “traps” electrons. The presence/absence is a 1 or 0 Memory cells can withstand a limited number of program-erase cycles. Controllers use a technique called wear leveling to distribute writes as evenly as possible across all the flash blocks in the SSD.

What did Apple put in its iPods? Samsung flash 16 GB shuffle nano classic touch Toshiba 1.8-inch HDD 80, 120, 160 GB Toshiba flash 2 GB Toshiba flash 32, 64 GB 24

Flash Memory in Smart Phones 25 iPhone 6: up to 128 GB

Flash Memory in Laptops – Solid State Drive (SSD) 26 capacities up to 512GB

iClicker Question We have the following disk: – Cylinders, 1 ms to cross 1000 Cylinders – RPM = 4 ms per rotation – Want to copy 1 MB, transfer rate of 1000 MB/s – 1 ms controller processing time What is the access time using our model? Disk Access Time = Seek Time + Rotation Time + Transfer Time + Controller Processing Time 27 ABCDE 10.5 ms9 ms8.5 ms11.4 ms12 ms

iClicker Question We have the following disk: – Cylinders, 1 ms to cross 1000 Cylinders – RPM = 4 ms per rotation – Want to copy 1 MB, transfer rate of 1000 MB/s – 1 ms controller processing time What is the access time? Seek = # cylinders/3 * time = 15000/3 * 1ms/1000 cylinders = 5ms Rotation = time for ½ rotation = 4 ms / 2 = 2 ms Transfer = Size / transfer rate = 1 MB / (1000 MB/s) = 1 ms Controller = 1 ms Total = = 9 ms 28

“And in conclusion…” I/O gives computers their 5 senses I/O speed range is 100-million to one Polling vs. Interrupts DMA to avoid wasting CPU time on data transfers Disks for persistent storage, replaced by flash 29