Operating System Concepts (X) - mass memory structure

I. Introduction

(A), the disk

1, a high capacity external memory
2 can store information by magnetic recording on the magnetic sheet. Each two magnetic disk surfaces, magnetic surfaces each divided into a plurality of circular tracks, each track divided into a plurality of sectors, a magnetic track with the arm position covered by a set of cylindrical configuration
3, the performance of the disk transmission rate lower than the effective transmission rate, the bit rate is the head reads from the magnetic medium, but is different from the transmission rate of the transport block os

(B), the tape

1, read by the magnetic read-write head
2, FireWire: an excuse to connect external devices to the computer system

Second, the disk structure

1, the logic array can be seen as a one-dimensional block, the logical block is the smallest transmission unit
2, a logical block mapping sequence to an array of disk sectors, sector 0 is the first track of the outermost cylinder the first sector. Press the track sectors sequentially, and then the inner cylinder in accordance with the order of the track, and then in accordance with the order from the outside of the cylinder
3, the number of sectors may be external track 40% more, and therefore the track density to be heretics to continue to reduce ensure that the data rate remains unchanged

Third, the disk subsidiaries

1, there are two ways to access the disk computer:
① I / O port (host Attached Storage): the DMA transfer mode signal comprising a mode
remote host (network attached storage) ② distributed file system
2, the host Attached Storage: a package within the host , accessed via a local I / O port
3, network-attached storage NAS: NAS be accessed by calling the remote process interface provides a convenient method for a shared storage pool, naming and access consistent with the host subsidiary, but lower efficiency, performance worse
4, a storage area network SAN: one of the drawbacks is the NAS storage I / O operation must bandwidth data network, thereby increasing network communication delay ; a SAN is a private network between server and storage means

Fourth, disk scheduling

1, the evaluation disk scheduling requirements for the moving distance of the magnetic head
2, one of the tasks of the OS is to effectively use the hardware, that is, faster access to the wider bandwidth of the disk drive for the disk
3, disk bandwidth: Total transfer divided by the number of bytes to transfer a service request start time end time
4, the access time: a seek time and rotational delay, we need to find a minimum time of
5, disk scheduling algorithm is a separate module of the OS

(A), FCFS scheduling

1, that FIFO scheduling, can solve the problem of hunger, but not the most optimal algorithm

(B), SSTF scheduling

1, selected from the current head position from the nearest (i.e., having the shortest seek time) request
2, a shortest job first (STF) scheduling essence, is a local optimization algorithm
3, the algorithm is not optimal, but FCFS scheduling is typically 1/3
4, may cause starvation of some requests, because of the need to consider the request is not necessarily arrive simultaneously to
5, and preferably is a conventional scheduling algorithm performance, appropriate

(C), SCAN scheduling

1, also called elevator dispatching, disk arm moves back and forth on the disk, the head scans back and forth, if the current position exactly request, which is performed
2, needs to know the current position and the moving direction of the magnetic head
3, can be improved starvation, but still occur hunger (the book here that is unlikely to lead to hunger, but after thinking and found still possible. considering the request is not necessarily arrive at the same time, if the disk read and write speeds to slow incoming requests, there may have been stuck in a head position . for example: the cafeteria Da Fan, an aunt in charge of three windows, and back and forth scanning Dafan window if a person is very large, and has been crowded forward, then, would have been to aunt the window people Dafan)

(D), C-SCAN scheduling

1, is a variant of the SCAN, the head section to move the disk from the other end, the processing request, but does not return when the processing request, seen as equivalent to a circular linked list cylinder
2, my personal opinion is: before head It is reciprocated on a disk radius, and now, is to do a one-way movement jump

(Five), LOOK scheduling

1, and SCAN similar, but it does not run to the other end of the magnetic head, i.e., not through the entire width of the disk, but only until the request moved farthest one direction

(F), C-LOOK scheduling

1, and C-SCAN similar, but it does not run to the other end of the magnetic head, i.e., not through the entire width of the disk, but only until the request moved farthest one direction

Fifth, Disk Management

(A), disk formatting

1, low-level formatting: also called physical formatting, the disk into sectors of the disk controller can read and write, using a special data structure for each sector.
2, the data structure of the head of FIG. Typically, a data area and tail, head and tail contains some information used by the disk controller, such as a sector number and an error code
3, in order to store the file, the OS must be recorded on the disk in a certain data structure, there are two steps, first partitions the logical format (high-level format, to create a file system)
. 4, the OS may each partition as a separate disk
5, at the time of logical formatting, OS initial file system data structure stored on a disk, comprising free space and allocated an initial empty directory

(B), the guide block

1, an initialization program runs on restart, i.e., the bootloader from various aspects, the system initializes, registers from the CPU to the memory device and a controller, then starts the OS, for this purpose, the bootstrap program needs to be able to find the kernel, and means into memory, and go to the starting location OS
2, think: after power-up, the program first performs a power on Self Test (pOST program), this procedure is in the BIOS (BIOS ROM chip is on), if an error will terminate the boot; otherwise, execute the bootstrap program (bootstrap) this program is in that sector 0 400 bytes. If no secondary boot program (long before the old system, not OS) directly to the OS kernel into memory, and jumps to the first instruction of the OS
3, I think, including the BIOS POST above program, the bootstrap program (initialization), the boot program, by hardware output program stored on the ROM chip, interrupt program routine, provided the system, POST program, the self-test program, the program is not the bootstrap from above For program
4, the overwhelming majority are PC, the bootstrap program stored in the ROM, because without initializing ROM and is located in a fixed position, and the system is not affected by computer viruses. But only a small part of the complete bootloader fast start on the disk, in a fixed position, known as the boot or system disk. Further transferred to a more complete bootstrap program from the disk when the role of small bootstrap program. This period I prefer the bootstrap program as boot program.
5. Windows2000, which boot code in the first sector (Master Boot Record MBR)

(C), the bad block

1, a broken or more sectors
2, for manual processing may be simple disk, such as finding by the format, or chkdsk lookup (used only for damaged), data loss occurs
3, more complex disk, the controller (disk) maintains a disk bad block list, some low-level format aside spare block, see the OS, when there is a bad block, the controller usable spare blocks for substitution

Sixth, swap space management

1, swap space: Virtual memory uses disk space as an extension of main memory, the regional block exchange (replacement pages) is to take place
2, to be created on a regular file system, or in a separate disk partition. Usually within a single large file system (external fragmentation may result in multiple seek to increase space), can also be created on a separate disk partition (internal fragmentation may increase)

Seven, RAID configuration

RAID has two directions, i.e., performance and reliability, and redundancy are achieved by dispersing

(A), redundant array of disk technology

1, is generated by a plurality of small redundancy for reliability magnetic disk
2, a disk is assumed that the error rate (how long a time may be wrong) is a, then the probability of n disks is a / n, the possibility of error becomes shorter , so the need to introduce redundancy, store additional information, you can replace repair when something goes wrong
3, the easiest way is to mirror that copy each disk

(II) dispersing

1, i.e., to change the way of performance through parallel processing. The data dispersion, by dispersing a plurality of data on a disk, the transmission rate can be improved, there are two ways:
① Position dispersion: a dispersion of the individual bits of each byte of the plurality of disks, disk 8 may be combined into a single disk using , access can be processed per second and a single disk consistent, but more accessible data, data can be accessed eight times, corresponding to combined disk
② block-level dispersion: a dispersion may block a file across multiple disks
2 disk parallel purpose:
① through load balancing to increase throughput of a plurality of small access (access to the page) in
② large decrease the response time of access, no longer corresponds to the need to replace the disks

(Three), RAID level

Mirror high reliability, but expensive; dispersion can increase the transmission rate, but did not change the reliability, therefore, can be dispersed by the parity way to provide different redundancy schemes, due to the different cost-effective solution can be generated at different levels :
. 1, the RAID 0: no redundancy, the dispersion according to the block level
2, RAID 1: disk mirroring, by dispersing the block level
3, RAID 2: the error correcting code structure, the memory system embodiment of the memory have a one byte per se parity bits, the error can be detected a single bit. Error correction scheme requires the presence of two or more additional check bits, may be present in different disks, and data can be reconstructed by the check bits being damaged disk. Corresponding to three data disks four check disk
4, RAID 3: bit interleaved parity configuration, bit-level dispersion, only one parity disk at this time, can be corrected for four data disks
5, RAID 4: parity block interleaver structure, block-level dispersion, then the parity bit is not an additional bit, but other disk blocks corresponding parity block, then only one parity disk, may be corrected for the four data disk
6, RAID 5: fast distribution of the parity interleave structure, the block-level dispersion, the parity data is distributed across all the n + 1 disks, the parity bit and data bits are intertwined, it is the most common structure
7, RAID 6: P + Q redundancy program, using error correction codes, such as every four bits with two redundancy data bits, parity bits instead of
8, RAID 0 + 1: the first disks each group is dispersed, is mirrored, if a disk error occurs all are unable to use
9, RAID 1 + 0: each set of disks to be mirrored, then disperse, if a disk error can still use other

(IV), tertiary storage structure

1, a removable disk: a floppy disk, once disc, optical disc
2, a magnetic tape: a large-capacity, random access process is very slow
3, future technologies: holographic storage, the MEMS (microelectromechanical systems)

Eight, OS jobs

Two main tasks of the OS to manage the physical device, and provides a virtual machine for the application abstraction, there are two disk abstract schemes:
① fitments: only array data block
② file system
1, the application interface: most disks and the tape will have an application interface for the driver to use, the overwhelming majority tape drive has a rea position to return to the logical block number of the head where the write time will delete all contents written after position
2, file name: generally not removable medium namespaces solve the problem, but to applications and users to decide how to access and interpret the data, fortunately, it has now been standardized
3, hierarchical storage management: automatic CD tower, switching within a tape or optical drives with removable disks without the need for manual intervention. Hierarchical storage system extends the storage hierarchy, may be added to the removable storage for extended file system
4, performance: contains speed, reliability, price
① speed: include bandwidth (drive sustained bandwidth, effective bandwidth) and latency
② Reliability: weaker than the fixed disk removable disk
③ price: main memory larger than disk

Published 205 original articles · won praise 110 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_40851744/article/details/103622165