SE350: Operating Systems
Lecture 13: I/O and Storage Devices
SE350: Operating Systems Lecture 13: I/O and Storage Devices - - PowerPoint PPT Presentation
SE350: Operating Systems Lecture 13: I/O and Storage Devices Outline I/O subsystem Magnetic storage Flash memory Whats Next? So far in this course: We have learned how to manage CPU and memory What about I/O?
Lecture 13: I/O and Storage Devices
they will perform?
The System Call Interface Process Management Memory Management Filesystems Device Control Networking Architecture Dependent Code Memory Manager Device Control Network Subsystem File System Types Block Devices IF drivers Concurrency, multitasking Virtual memory Files and dirs: the VFS TTYs and device access Connectivity
network
FILE fd = fopen("/dev/something", "rw"); for (int i = 0; i < 10; i++) { fprintf(fd, "Count %d\n", i); } close(fd);
kernel fills buffer and notifies user
takes data and notifies user
Other Devices
Address + Data Interrupt Request Interrupt Controller
Bus Adaptor Bus Adaptor
Device Controller
read write control status
Addressable Memory and/or Queues Registers (port 0x20)
Hardware Controller
Memory Mapped Region: 0x8f008020 Bus Interface Processor Memory Bus
CPU
Regular Memory
between DRAM and I/O
memory into physical address space
// To read
(also called the “frame buffer”) changes image on screen
Audio Controller Keyboard Controller Disk Controller DRAM Physical Address Ranges
0x00000000 0xFFFFFFFF 0xC0003000 0xC0002000 0xC0001000 = 232-1 0x7FFFFFFF
4 5 6 1 2 3
0"" 5"" 10"" 15"" 20"" 25"" 30"" 35"" 40"" 45"" 50"" 0"" 2,000"" 4,000"" 6,000"" 8,000"" 10,000"" 12,000"" 14,000"" 16,000"" 18,000""
0"" 50,000""100,000"" 150,000"" 200,000"" 250,000"" 300,000"" 350,000"" 400,000"" 450,000"" 500,000""
Bandwidth)(mB/s))
Latency)(us))
Length)(b))
n = 1,280,000 bytes!
corrupted during writes (still small non-zero chance)
track t sector s spindle cylinder c platter arm read-write head arm assembly rotation
higher bandwidth
regions of tracks with same # of sectors/track
regions of disk
companies (like Google) reportedly
www.lorextechnology.com
Original position Desired data
Rotational latency Seek time Hardware Controller Software queue (device driver)
Request
Media Time (Seek+Rot+Xfer)
Result
Disk Latency = Queuing Time + Controller time + Seek Time + Rotation Time + Xfer Time
that alternate between outer and inner tracks
until all requests satisfied, then reverse direction
until all requests satisfied, then start again from farthest request
short track switch has rotational delay
Figures: www.androidcentral.com and flashdba.com
Host Buffer Manager (software Queue) Flash Memory Controller DRAM
NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND NAND
SATA
(e.g., keep blocks of file together)
According to John Kubiatowicz (New York Times, Oct 24, 2011)
(These are changing rapidly!)
globaldigitalcitizen.org