Download Hard Disk Storage and Management in Database Systems and more Study Guides, Projects, Research Introduction to Database Management Systems in PDF only on Docsity! Storage and Indexes Introduction to Databases Computer Science 557 Instructor: Joe Bockhorst University of Wisconsin - Milwaukee Announcements • Any problems logging in to course accounts? • Use grid3, grid5 or weise for course work – Send bugs on weise to ceas-labstaff@uwm.edu • Reading Assignment: Chapter 14 in the textbook • Program 1 assigned today, due next Friday ca, Anatomy of a Hard Disk
(a) A single-sided disk with read/write hardware. (b) A disk pack with read/write hardware.
Track
o | ————
Read/write
Actuator Arm head Spindle Disk rotation
y
(b)
CL >
Cylinder
of tracks
(imaginary)
<a
Actuator movement
Hard Drive Glossary • Disks are divided into concentric circular tracks on each disk surface. – Track capacities vary typically from ~ 4 to 50 Kbytes • The division of a track into sectors is hard-coded on the disk surface and cannot be changed • A block is an integer number of sectors – The block size B is fixed for each system. • Typical block sizes range from B=512 bytes to B=4096 bytes. – Whole blocks are transferred between disk and main memory Typical Disk Parameters
Table 13.1
Specifications of Typical High-end Cheetah Disks from Seagate
Description
Model Number
Form Factor (width)
Form Factor (height)
Height
Width
Length
Weight
‘Capacity/Interface
Formatted Capacity
Interface Type
‘Configuration
Number of disks (physical)
‘Number of heads (physical)
‘Number of Cylinders
Total Tracks
Bytes per Sector
Areal Density
‘Track Density
Kecording Density
Bytes/Track (avg)
Performance
‘Transfer Rates
Internal Transfer Rate (min)
Internal Transfer Rate (max)
Formated Int. Transfer Rate (min)
Formated Int. Transfer Rate (max)
External I/O Transfer Rate (max)
Average Formatted Transfer Rate
Seek Times
‘Avg. Seek Time (Read)
Avg. Seek Time (Write)
Track-to-track, Seek, Read
‘Track-to-track, Seek, Write
Full Dise Seek, Read
Full Disc Seek, Write
Average Latency
Other
Default Buffer (cache) size
Spindle Speed
Power-on to Ready Time
Cheetah 10K.6
ST3146807LC
3.5 inch
ch
254mm
101.6 mm
146.05 mm
0.73 Kg
146.8 Gbytes
80-pin
4
8
49,854
512
36,000 Mb/sq.inch.
64,000 Tracks/inch
570,000 bits/inch
475 Mb/sec
840 Mb/sec
43 MB/sec
78 MB/sec
320 MB/sec
59.9 MB/sec
4.7 ms (typical)
5.2 ms (typical)
0.3 ms (typical)
0.5 ms (typical)
2.99 ms
8,000 KB
10000 RPM
Cheetah 10K.7
$T3300007LW
3.5 inch
Linch
25.4 mm
101.6mm
146.05 mm
0.726 kg
300 Gbytes
68-pin
4
8
90,774
726,192
512
105,000 Tracks/inch
658,000 bits/inch
556
472 Mb/sec
944 Mb/sec
59 MB/sec
118 MB/sec
320 MB/sec
59.5 MB/sec
4.7 ms (typical)
5.3 ms (typical)
0.2 ms (typical)
0.5 ms (typical)
9.5 ms (typical)
10.3 ms (typical)
3 msec
8,192 KB
10000 RPM.
25 sec
(Courtesy of Seagate Technology)
Why not store DB in main memory? • $$$$ – cost of RAM is > 100 X hard drive cost • main memory is volatile • 32 bit addressing Managing the Hard Disk Query Optimization Relational Operators Files and Access Methods Buffer Management Disk Space Management The DSM provides an abstraction of the block as a unit of data DSM interface includes commands to read and write block commands I/O requests Operations Supported by DSM • allocate_blocks(num_blocks) – Add blocks to DB • deallocate block(blockID) – Remove block from DB • write_block(blockID, blockPtr) – Write block to disk • read_block(blockID, blockPtr) – Read block from disk allocate_blocks(3) write_block(5,data) read_block(5) deallocate block(2) Example: Managing the Hard Disk Disk Space Manager 1 yes 2 3block ID yes yesallocated? N-1 N no no 4 5 yes yes 792 793 794 * *902 903hardware addr 6 yes 7 no 904 * //allocate three consecutive blocks allocate_blocks(3) write_block(5,data) read_block(5) deallocate block(2) Example: Managing the Hard Disk Disk Space Manager 1 yes 2 3block ID yes yesallocated? N-1 N no no 4 5 yes yes 792 793 794 * *902 903hardware addr 6 yes 7 no 904 * //write blockID 5 to disk write_block(903,data) allocate_blocks(3) write_block(5,data) read_block(5) deallocate block(2) Example: Managing the Hard Disk Disk Space Manager 1 yes 2 3block ID yes yesallocated? N-1 N no no 4 5 yes yes 792 793 794 * *902 903hardware addr 6 yes 7 no 904 * // read blockID 5 to buffer read_block(903) Buffer Manager Operations • add_blocks_to_DB(num_blocks) – add new blocks to DB • delete_block_from_DB(block_id) – delete block from the DB • pin_block(block_id) – bring block from disk to buffer pool if not in BP – increment pin count for block • unpin_block(block_id) – decrement pin count for block • mark_dirty(block_id) • Buffer Manager maintains for each frame – pin count – dirty bit Buffer Manager Example buffer pool with M frames1 2 3 M-1 M - - - - - 0 0 0 0 0 no no no no no block ID pin count dirty initial state of buffer manager 1 2 3 N-1 N Buffer Manager Example buffer pool with M frames1 2 3 M-1 M 76 22 - - - 2 1 0 0 0 no no no no no block ID pin count dirty initial state of buffer manager draw on whiteboard 1 2 3 N-1 N