当前位置:网站首页>Royal treasure: physical storage medium

Royal treasure: physical storage medium

2022-06-24 05:56:00 Write about Nancheng

1. Storage system hierarchy

The hierarchical structure of a typical storage medium is shown in the following figure

(1) Cache memory : Storage technology that increases the speed of main memory . The purpose is to solve CPU And main memory , But the storage speed is very fast .

(2) Main memory : Also known as main memory or memory . The execution of every instruction or operation on every data in a computer , They all act on information residing in main memory . characteristic : Random access and volatility .

(3) Virtual memory : Make up the virtual storage and storage management unit , While allowing people to use a much larger address space than the main memory capacity to access the main memory .

(4) Secondary memory : Also called auxiliary memory or external memory . Slower than memory , The storage capacity is much larger than the memory , And most of them support random access , There are relatively few differences in the time required to access different data items . Such as : Compact disc 、 disk 、 Move U Plate, etc. .

(5) Three level memory : The data volume of some databases is much larger than the capacity that can be stored on the disks of a single or even a large cluster system . Therefore, three-level memory technology is proposed , The data capacity used to store the Ethernet byte count . characteristic : Large storage capacity 、 Slow reading and writing .

2. The structure of disk storage

Using secondary storage is one of the important characteristics of database management system , Secondary storage is almost always disk based .

The structure of disk is mainly composed of disk combination and head combination . Disk combination is composed of one or more circular disks , They rotate around a central axis . The head combination consists of one or more heads , Used to read and write information on disk . Memory cells that store binary bits are organized into tracks , Tracks are organized into sectors , A sector is an indivisible physical unit of a disk . Disks are also usually logically divided into blocks , Each block consists of one or more sectors . Each block is also a logical unit of data transferred between the disk and main memory , The size of the block is usually 4~56KB. In main memory , These blocks are often referred to as pages or logical blocks .

Disk read / write efficiency mainly depends on seek and rotation operations , The purpose of disk scheduling strategy is to reduce mechanical motion .

Strategies for optimizing seek time :

(1) First come, first served . Process each request in the order of access requests , No optimization , Low efficiency , Suitable for sparse requests .

(2) The nearest is preferred . Priority is given to requests near the current head position .

(3) Full range mobile scanning . The magnetic head is 0 The No. 1 track moves back and forth to the maximum track , Implement services along the way .

(4) Mobile scan . It's a strategy 3 Improvement , If there is no service request ahead , Then the magnetic head moves in the opposite direction .

(5) Group scan . Group channel requests , Intra group mobile scan , Go to the next group when this group is finished .

(6) Intermittent scanning . from 0 No. cylinder is scanned to the maximum No. cylinder , Every cylinder , Disk rotation n Time . After a week of scanning , The head returns directly 0 No. 1 cylinder , Don't stop on the way .

3.SQL server Storage architecture

(1) page

stay SQL server in , The basic unit of data storage is page , That is, the disk space allocated for the data files in the database can be logically divided into pages .

The size of the page is 8KB, The beginning of each page is 96KB At the top of the page , Used to store system information about the page , This information includes page numbers 、 Page type 、 The available space of the page and the allocation unit of the object that owns the page ID.

On the data page , The rows of data are placed sequentially next to the top of the page . At the end of the page is the row offset table , For each line in the page , Each row offset table contains an entry . Each entry records the distance between the first byte of the corresponding line and the top of the page . The order of the entries in the row offset table is the reverse of the order of the rows in the page .

(2) District

In order to effectively manage pages ,SQL server All pages in the are stored in the store , District is the basic unit of managing space . A district consists of 8 Physically continuous pages make up .

SQL server Two types of zones are provided :

1) Unified area : Owned by a single object . All the people in the district 8 The page can only be used by the owning object .

2) Mixing zone : At most 8 Object sharing . In the area 8 Each page of a page can be owned by different objects .

4.SQL server Of I/O Architecture

The main purpose of a database is to store and retrieve data . therefore , Performing a large number of disk reads and writes is one of the essential characteristics of a database . disk I/O Operation takes up a lot of resources , And it takes a relatively long time to complete .

SQL server In the instance I/O Divided into logical I/O And physics I/O. Every time the database engine requests a page in the cache, a logical read will occur . If the page requested by the database engine is not in the cache , Then perform a physical read , Read the page from the cache .

原网站

版权声明
本文为[Write about Nancheng]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/07/20210730190544976o.html

猜你喜欢