Lecture 10 Scribe Notes 05-04-2010

by Allen Liang


File System Performance



Some Historical Background of Disk Performance













What's A Disk?



















Why Disks Are Slow




Humdrum Drive Numbers




Disk Failure and Prevention


Failure



Prevention




Disk Performance - READING




Reading Example 1 (unbuffered)


code

first time

later time

for (; ;)

{

char c;

if (read(fd, &c, 1) <= 0)

break;

process(c); // 1.0 micro second

}

  • 8.5 ms seek

  • 4.2 ms rotational

  • 0.004 ms transfer

  • total time = 12.7 ms

  • 0.001 ms process

  • 8.33 ms rotational

  • 0.004 ms transfer

  • total time = 8.4 ms




Batching for Read (Assuming Sequential)


Applying Batching to Reading Example 1 (above)


Applying Batching to Seagate Barracuda Disk (earlier)


More on Batching... (Pros and Cons)





Disk Performance – WRITING



Dallying for Write







WRITING Example 1


write(10); // dallying for fast performance therefore cache it (bytes might still not be on disk)

close(10);



Solutions to Prevent Failure from Dallying (New Syscalls)



WRITING Example 1 Modified


write(10); // dallying for fast performance therefore cache it (bytes might still not be on disk)

fsync(); // to prevent failure from dallying

close(10);



Multitasking




read_sector(...)

{

while( (lib(&0x1f7) & 0xc0 != 0x40) )

:

:

schedule(); // changed from “continue;” to “schedule()

}



Performance Metrics for I/O





Method

Latency

(in micro second)

Throughput

(in KB/s)

CPU

Utilization

(in %)

polling

100

10

5

batching

1000

21

10

interrupt

100

18

9

DMA+interrupt

(disk talks directly to RAM)

56

167

45

DMA+polling

(do not have to save state and avoid interrupt overhead)

50

180

85