Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 111 Chapter 11: Hardware (Slides by Hector Garcia-Molina,

Similar presentations


Presentation on theme: "Chapter 111 Chapter 11: Hardware (Slides by Hector Garcia-Molina,"— Presentation transcript:

1 Chapter 111 Chapter 11: Hardware (Slides by Hector Garcia-Molina, http://www-db.stanford.edu/~hector/cs245/notes.htm)

2 Chapter 112 Outline Hardware: Disks Access Times Optimizations Other Topics: –Storage costs –Using secondary storage –Disk failures

3 Chapter 113 The Big Picture: DBMS Data Storage

4 Chapter 114 P M Typical Computer Secondary Storage...

5 Chapter 115 Processor Fast, slow, reduced instruction set, with cache, pipelined… Speed: 100  500  1000 MIPS Memory Fast, slow, non-volatile, read-only,… Access time: 10 -6  10 -9 sec. 1  s  1 ns

6 Chapter 116 Secondary storage Many flavors: - Disk: Floppy (hard, soft) Removable Packs Winchester Ram disks Optical, CD-ROM… Arrays - TapeReel, cartridge Robots

7 Chapter 117 Focus on: “Typical Disk” Terms: Platter, Head, Cylinder, Track Sector (physical), Block (logical), Gap …

8 Chapter 118 Top View

9 Chapter 119 “Typical” Numbers Diameter: 1 inch  15 inches Cylinders:100  2000 Surfaces:1 (CDs)  (Tracks/cyl) 2 (floppies)  30 Sector Size:512B  50K Capacity:360 KB (old floppy)  30 GB (I use)

10 Chapter 1110 Disk Access Time block x in memory ? I want block X

11 Chapter 1111 Time = Seek Time + Rotational Delay + Transfer Time + Other

12 Chapter 1112 Rotational Delay Head Here Block I Want

13 Chapter 1113 Average Rotational Delay R = 1/2 revolution “typical” R = 8.33 ms (3600 RPM)

14 Chapter 1114 Transfer Rate: t “typical” t: 1  3 MB/second transfer time: block size t

15 Chapter 1115 Other Delays CPU time to issue I/O Contention for controller Contention for bus, memory “Typical” Value: 0

16 Chapter 1116 So far: Random Block Access What about: Reading “Next” block?

17 Chapter 1117 If we do things right (e.g., Double Buffer, Stagger Blocks…) Time to get = Block Size + Negligible block t - skip gap - switch track - once in a while, next cylinder

18 Chapter 1118 Rule ofRandom I/O: Expensive Thumb Sequential I/O: Much less Ex:1 KB Block »Random I/O:  20 ms. »Sequential I/O:  1 ms.

19 Chapter 1119 Cost for Writing similar to Reading …. unless we want to verify! need to add (full) rotation + Block size t

20 Chapter 1120 To Modify a Block? To Modify Block: (a) Read Block (b) Modify in Memory (c) Write Block [(d) Verify?]

21 Chapter 1121 Block Address: Physical Device Cylinder # Surface # Sector

22 Chapter 1122 Outline Hardware: Disks Access Times Optimizations Other Topics –Storage Costs –Using Secondary Storage –Disk Failures here

23 Chapter 1123 Optimizations (in controller or O.S.) Double Buffering Disk Scheduling Algorithms: sec. 11.5.4 –e.g., elevator algorithm

24 Chapter 1124 Double Buffering Problem: Have a File » Sequence of Blocks B1, B2 Have a Program » Process B1 » Process B2 » Process B3...

25 Chapter 1125 Single Buffer Solution (1) Read B1  Buffer (2) Process Data in Buffer (3) Read B2  Buffer (4) Process Data in Buffer...

26 Chapter 1126 SayP = time to process/block R = time to read in 1 block n = # blocks Single buffer time = n(P+R)

27 Chapter 1127 Double Buffering Memory: Disk: ABCDGEFA B done process A C B done

28 Chapter 1128 Say P  R What is processing time? P = Processing time/block R = IO time/block n = # blocks Double buffering time = R + nP Single buffering time = n(R+P)

29 Chapter 1129 Block Size Selection? Big Block  Amortize I/O Cost Big Block  Read in more useless stuff! and takes longer to read Unfortunately...

30 Chapter 1130 Trend As memory prices drop, blocks get bigger... Trend

31 Chapter 1131 Storage Cost 10 -9 10 -6 10 -3 10 -0 10 3 access time (sec) 10 15 10 13 10 11 10 9 10 7 10 5 10 3 cache electronic main electronic secondary magnetic optical disks tape optical disks tape typical capacity (bytes) from Gray & Reuter

32 Chapter 1132 Storage Cost 10 -9 10 -6 10 -3 10 -0 10 3 access time (sec) 10 4 10 2 10 0 10 -2 10 -4 cache electronic main electronic secondary magnetic optical disks tape optical disks tape dollars/MB from Gray & Reuter

33 Chapter 1133 Using secondary storage effectively Example: Sorting data on disk Conclusion: –I/O costs dominate –Design algorithms to reduce I/O Also: How big should blocks be?

34 Chapter 1134 Disk Failures (Sec 11.6) Partial  Total Intermittent  Permanent

35 Chapter 1135 Coping with Disk Failures Detection –e.g. Checksum Correction  Redundancy

36 Chapter 1136 At what level do we cope? Single Disk –e.g., Error Correcting Codes Disk Array Logical Physical

37 Chapter 1137 Operating System e.g., Stable Storage Logical BlockCopy A Copy B

38 Chapter 1138 Database System e.g., Log Current DBLast week’s DB

39 Chapter 1139 Summary Secondary storage, mainly disks I/O times I/Os should be avoided, especially random ones….. Summary

40 Chapter 1140 Outline Hardware: Disks Access Times Optimizations Other Topics –Storage Costs –Using Secondary Storage –Disk Failures here


Download ppt "Chapter 111 Chapter 11: Hardware (Slides by Hector Garcia-Molina,"

Similar presentations


Ads by Google