I/O Systems: Devices, Performance, Disk Organization, Optimizations, Trends, Slides of Computer Numerical Control

Various aspects of i/o systems, including i/o devices, performance issues, disk organization, and disk performance optimizations. It discusses the challenges of handling interrupts from i/o devices, the organization of magnetic disks, and methods for optimizing disk performance. The document also touches on disk technology trends.

Typology: Slides

2010/2011

Uploaded on 10/07/2011

christina
christina 🇺🇸

4.6

(23)

393 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
I/O Systems
Arvind Krishnamurthy
Spring 2004
I/O Devices
nTypically, IO devices generate an interrupt when something happens
nThree alternatives:
nRaise an interrupt for every byte transferred from/to the I/O device
nDo block transfers to memory (direct memory access or DMA) and
raise interrupt when transfer is done
nBitmap display CPU writes to video memory what should be
displayed, display reads video memory, illuminating pixels
nDone at user-level without kernel intervention
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download I/O Systems: Devices, Performance, Disk Organization, Optimizations, Trends and more Slides Computer Numerical Control in PDF only on Docsity!

I/O Systems

Arvind Krishnamurthy

Spring 2004

I/O Devices

n Typically, IO devices generate an interrupt when something happens

n Three alternatives:

n Raise an interrupt for every byte transferred from/to the I/O device

n Do block transfers to memory (direct memory access or DMA) and raise interrupt when transfer is done

n Bitmap display – CPU writes to video memory what should be displayed, display reads video memory, illuminating pixels n Done at user-level without kernel intervention

Performance issues

n Terminals, modems are connected to computers via serial

lines

n Raise an interrupt for every character n CPU could get swamped due to “overhead” of handling each byte n Example: 10 terminals connect at 9600 baud (about 1KB/s) n 10 thousand interrupts per second n If each interrupt takes 1 us to handle, load = 0.01 secs = 1% n If each interrupt takes 100 us to handle, CPU is loaded

n Block device performance depends

n Overhead to initiate a request n Latency of performing a 1 byte transfer (dominates cost of small I/Os) n Bandwidth of I/O transfer once started (dominates cost of large transfers)

Disk organization

n Disk surface

n Circular disk coated with magnetic material

n Tracks

n Concentric rings around disk surface, bits laid out serially along each track

n Sectors

n Each track is split into arc of track (min unit of transfer)

sector

Disk Performance

n Depends on locality of access n If reading next sector immediately after reading previous sector, no need to wait n If reading next sector after a small delay, need to wait for disk to finish the current rotation (assuming no track buffers ) n If track buffers, next access within the same track is fast

n If random place in same cylinder n No seek needed n Just rotational delay (3ms) n Transfer (0.04 ms) n Total time is 3.04ms or about 330 KB/sec

n If random place in same cylinder, but read 10KB instead n Rotational delay (3ms) + Transfer (0.4ms) n Total time is 3.4ms or about 3MB/sec

Bandwidth w/ seek & rotation

n Seek time and rotational

latency dominates the cost

of small reads

n A lot of disk transfer bandwidth is wasted n Need algorithms to reduce seek time

n There are more sectors on

outer tracks than inner

tracks

n For example, reading outer tracks could be 40MB/sec, while reading inner tracks could be 25MB/sec

2Mbytes 90%

1Mbytes 83%

256Kbytes 55%

8Kbytes 3.7%

1Kbytes 0.5%

% of Disk Transfer Bandwidth

Block Size (Kbytes)

Disk Performance Optimizations

n Minimize seek and rotational latency by putting related

data together

n Always read/write large amounts of data

n If there are multiple requests, adaptively schedule the

requests

n Use multiple arms? Use multiple disks?

n Can we improve both bandwidth and latency?

Scheduling Disk Requests

n Method FIFO

n First come first serve

n Pros

n Fairness among requests n In the order applications expect

n Cons

n Arrival may be on random spots on the disk (long seeks) n Consider files accessed at a server – merging accesses from different users n Wild swings can happen

C-SCAN (Circular SCAN)

n Method

n Like SCAN n But, wrap around n Real implementation doesn’t go to the end

n Pros

n Uniform service time

n Cons

n Do nothing on the return

Disk caching

n Method

n Disk controller has a piece of RAM to cache recently accessed blocks n IBM Ultra160 SCSI has 16MB n Some of the RAM space stores “firmware” (an OS) n Blocks are replaced usually in LRU order

n Pros

n Good for reads if you have locality

n Cons

n Expensive n Need to deal with reliable writes

n Disks are getting cheaper ($/MB)

n About a factor of 2 per year since 1991

n Disk data is getting denser

n More bits/square inch n Tracks are closer together n Doubles density every 18 months n Head close to surface

n Disks are getting smaller for similar capacity

n Spin faster, less rotational delay, higher bandwidth n Less distance for head to travel (faster seeks) n Lighter weight (for portables)

Disk Technology Trends

Announcements

n Paper reviews for the week after spring break:

n A fast file system for Unix (Monday: 3/22) n Log Structured File Systems (Wednesday: 3/24)

File usage patterns

n How do users access files?

n Sequential: bytes read in order n Random: read/write element out of middle of arrays n Content-based access: find me next byte starting with “CS422”

n How are files used?

n Most files are small n Large files account for most of the bytes transferred n Large files use up most of the disk space

n Bad news

n Need everything to be efficient

Data structures for Disks

n A file header for each file (part of the file meta-data)

n Disk sectors associated with each file

n A data structure to represent free space on disk

n Bit map n 1 bit per block (or sector) n blocks numbered in cylinder-major order, why? n How much space does a bitmap need for a 4G disk? n Linked list

n Caching: keep most recently accessed blocks in memory

Approach 1: Contiguous allocation

n Request in advance for the size of the file

n Search bit map or linked list to locate a space

n File header

n first sector in file n number of sectors

n Pros

n Fast sequential access n Easy random access

n Cons

n External fragmentation n Hard to grow files

Approach 2: Linked files

n File header points to 1st

block on disk

n A block points to the next

n Pros

n Can grow files dynamically n Free list is similar to a file n No waste of space

n Cons

n Sequential access: slow n random access: horrible n unreliable: losing a block means losing the rest

File header

null

Multi-level indexed files

outer-index

index table file

n 13 Pointers in a header

n 10 direct pointers n 11: 1-level indirect n 12: 2-level indirect n 13: 3-level indirect

n Pros & Cons

n In favor of small files n Can grow n Limit is 16G (assuming 1K blocks)

n What happens to reach

block 23, 5, 340?

1 2

data

data

11 12 13 data

. data

. data

Combined Scheme (Unix 4.1)

File header storage

n Where is file header stored on disk?

n In (early) Unix & DOS FAT file systems, special array in outermost cylinders

n Unix refers to file by index into array --- tells it where to

find the file header

n “i-node” --- file header; “i-number” --- index into the array

n Original Unix file header organization:

n header not anywhere near the data blocks. To read a small file, seek to get header, seek back to data.

n fixed size, set when disk is formatted.

File header storage (cont’d)

n Why not put headers near data?

n Reliability: whatever happens to the data, you can find all of the files. n Unix BSD 4.2 puts portion of the file header array on each cylinder. For small directories, can fit all data, file headers, etc. in same cylinder Ë no seeks! n File headers are much smaller than a whole block (a few hundred bytes), so multiple file headers fetched from disk at same time.

n Q: do you ever look at a file header without reading the

file?

n Yes! Reading the header is 4 times more common than reading the file (e.g., ls, make).

n Superblock defines a file system

n size of the file system n size of the file descriptor area n free list pointer, or pointer to bitmap n location of the file descriptor of the root directory n other meta-data such as permission and various times

Super block

File descriptors (i-node in Unix) File data blocks Boot block

Disk Layout