Course Database Management Systems - Chapter 1: Disk Storage, Basic File Structures and Hashing - Nguyen Thanh Tung
Disk Storage Devices
Files of Records
Operations on Files
Unordered Files
Ordered Files
Hashed Files
Dynamic and Extendible Hashing Techniques
RAID Technology
Files of Records
Operations on Files
Unordered Files
Ordered Files
Hashed Files
Dynamic and Extendible Hashing Techniques
RAID Technology
Bạn đang xem 20 trang mẫu của tài liệu "Course Database Management Systems - Chapter 1: Disk Storage, Basic File Structures and Hashing - Nguyen Thanh Tung", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.
File đính kèm:
- course_database_management_systems_c1_disk_storage_basic_fil.pdf
Nội dung text: Course Database Management Systems - Chapter 1: Disk Storage, Basic File Structures and Hashing - Nguyen Thanh Tung
- Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and Extendible Hashing Techniques RAID Technology 2
- Disk Storage Devices (cont.) Because a track usually contains a large amount of information, it is divided into smaller blocks or sectors . The division of a track into sectors is hard-coded on the disk surface and cannot be changed. One type of sector organization calls a portion of a track that subtends a fixed angle at the center as a sector. A track is divided into blocks. 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 for processing. 4
- Disk Storage Devices (cont.) A read-write head moves to the track that contains the block to be transferred. Disk rotation moves the block under the read-write head for reading or writing. A physical disk block (hardware) address consists of a cylinder number (imaginary collection of tracks of same radius from all recorded surfaces), the track number or surface number (within the cylinder), and block number (within track). Reading or writing a disk block is time consuming because of the seek time s and rotational delay (latency) rd. Double buffering can be used to speed up the transfer of contiguous disk blocks. 6
- Records Fixed and variable length records Records contain fields which have values of a particular type (e.g., amount, date, time, age) Fields themselves may be fixed length or variable length Variable length fields can be mixed into one record: separator characters or length fields are needed so that the record can be “parsed”. 8
- Files of Records A file is a sequence of records, where each record is a collection of data values (or data items). A file descriptor (or file header) includes information that describes the file, such as the field names and their data types , and the addresses of the file blocks on disk. Records are stored on disk blocks. The blocking factor bfr for a file is the (average) number of file records stored in a disk block. A file can have fixed-length records or variable-length records. 10
- Operation on Files Typical file operations include: OPEN: Reads the file for access, and associates a pointer that will refer to a current file record at each point in time. FIND: Searches for the first file record that satisfies a certain condition, and makes it the current file record. FINDNEXT: Searches for the next file record (from the current record) that satisfies a certain condition, and makes it the current file record. READ: Reads the current file record into a program variable. INSERT: Inserts a new record into the file, and makes it the current file record. 12
- Unordered Files Also called a heap or a pile file. New records are inserted at the end of the file. To search for a record, a linear search through the file records is necessary. This requires reading and searching half the file blocks on the average, and is hence quite expensive. Record insertion is quite efficient. Reading the records in order of a particular field requires sorting the file records. 14
- Hashed Files Hashing for disk files is called External Hashing The file blocks are divided into M equal-sized buckets , numbered bucket0, bucket1, , bucketM-1. Typically, a bucket corresponds to one (or a fixed number of) disk block. One of the file fields is designated to be the hash key of the file. The record with hash key value K is stored in bucket i, where i = h(K), and h is the hashing function . Search is very efficient on the hash key. Collisions occur when a new record hashes to a bucket that is already full. An overflow file is kept for storing such records. Overflow records that hash to each bucket can be linked together. 18
- Dynamic And Extendible Hashing (cont.) The directories can be stored on disk, and they expand or shrink dynamically. Directory entries point to the disk blocks that contain the stored records. An insertion in a disk block that is full causes the block to split into two blocks and the records are redistributed among the two blocks. The directory is updated appropriately. Dynamic and extendible hashing do not require an overflow area. Linear hashing does require an overflow area but does not use a directory. Blocks are split in linear order as the file expands. 24
- Parallelizing Disk Access using RAID Technology. Secondary storage technology must take steps to keep up in performance and reliability with processor technology. A major advance in secondary storage technology is represented by the development of RAID, which originally stood for Redundant Arrays of Inexpensive Disks. The main goal of RAID is to even out the widely different rates of performance improvement of disks against those in memory and microprocessors. 26
- RAID Technology (cont.) Different raid organizations were defined based on different combinations of the two factors of granularity of data interleaving (striping) and pattern used to compute redundant information. Raid level 0 has no redundant data and hence has the best write performance. Raid level 1 uses mirrored disks. Raid level 2 uses memory-style redundancy by using Hamming codes, which contain parity bits for distinct overlapping subsets of components. Level 2 includes both error detection and correction. Raid level 3 uses a single parity disk relying on the disk controller to figure out which disk has failed. Raid levels 4 and 5 use block-level data striping, with level 5 distributing data and parity information across all disks. Raid level 6 applies the so-called P + Q redundancy scheme using Reed-Soloman codes to protect against up to two disk failures by using just two redundant disks. 28
- Storage Area Networks (contd.) Advantages of SANs are: Flexible many-to-many connectivity among servers and storage devices using fiber channel hubs and switches. Up to 10km separation between a server and a storage system using appropriate fiber optic cables. Better isolation capabilities allowing nondisruptive addition of new peripherals and servers. SANs face the problem of combining storage options from multiple vendors and dealing with evolving standards of storage management software and hardware. 32