Computer Science 111, Spring 2010

Lecture 10, File System: Performance 5/4/10

By: David Chan, Zev Solomon.

Why Disks are Slow

Hard Disk Diagram

Suppose we want to run this code:

For (;;) {
	char c;
	if (read(fd, &c, 1) <= 0)
		break;
	process(c)

}

It takes this long:

8.5 ms seek
4.2 ms rotational
.004ms xfer
It takes us 12.7ms per character
8.4 ms avg (2x rotational, because the disk has to make another full rotation, no seek time)
We run this for ~120 characters/sec (REALLY SLOWWWWWWWWWpoke)

How do we make this faster?

Batching

 

Bigger Batches

 

Will this trick work for writing too?

Our implementation of prefetching made an assumption:

Locality of Reference

Speculation

Emacs Problem:

		sync(); //schedule entire cache to be written
		fsync(fd); //all of data and metadata for file sent to disk (The problem is that it is slow)
fdatasync(fd); //Only the data

Multitasking

Performance Metrics for I/O

 

Example Strategies + metric

Method

Latency

Throughput

Utilization

Polling

100 μs

10 KB/s

5%

Batching

1000 μs

21 KB/s

10%

Interrupts

100 μs

18 KB/s

9%

DMA + interrupts

56 μs

167 KB/s

45%

DMA + polling

50 μs

180 KB/s

85%

Valid HTML 4.01 Strict