Talking about several methods of external storage allocation, talking about external storage allocation

Source: Internet
Author: User

Talking about several methods of external storage allocation, talking about external storage allocation

External Storage refers to memory other than cpu cache and memory. Hard disks, optical disks, and USB flash disks can all be called external storage. All the data also exists here, so the allocation method becomes extremely important, which directly affects the computer's running speed.

External Storage allocation methods include continuous allocation, chain allocation, and index allocation.


1. Continuous allocation

Principle: When a file is created, a group of consecutive blocks are allocated. Each file in the FAT (document Allocation Table) contains only one entry, indicating the start block and file length. It is advantageous for sequential files.

Advantages: 1. Simple. Applicable to one-time write operations. 2. Support sequential access and random access, and fast sequential access. 3. The required disk seek times and seek time are the least. (Because of the continuity of space, when accessing the next disk block, you generally do not need to move the head. When you need to move the head, you only need to move one track .)

Disadvantages: 1. Files cannot grow dynamically. (It is possible that the empty block at the end of the file has been allocated to another file .) 2. It is not conducive to file insertion or deletion. 3. External fragmentation issues. (After files are added and deleted repeatedly, it is difficult to find continuous blocks with sufficient space and require compression .) 4. The size of the lifecycle file is required during file creation.



Ii. Chain allocation

Principle: The information of a file is stored in several discontinuous physical blocks. Each block is connected by a pointer. The previous physical block points to the next physical block. Each file in fat also only needs one item, including the file name, start block number, and last block number. Any free block can be added to the chain.

Advantages: 1. Improve disk space utilization, and there is no external fragmentation problem. 2. Facilitate file insertion and deletion. 3. facilitate the dynamic expansion of files.

Disadvantages: 1. Slow access, generally only applicable to sequential access of information, not random access. 2. To search for a piece, you must follow the pointer from start to end. 3. reliability issues, such as pointer errors. 4. More seek times and time. 5. The link pointer occupies a certain amount of space. Multiple blocks are grouped into clusters and allocated by cluster instead of by block. (Increased disk fragmentation)

Using the FAT file allocation table method, link allocation variants such as MS-DOS and OS/2.


Iii. index allocation

Principle: each file has a first-level index in FAT, and the index contains the entries for each partition allocated to the file. The file index is stored in a separate block, and the file entry points to this block in FAT.

Advantages: 1. Maintain the advantages of the Link Structure and solve its disadvantages: fast distribution can eliminate external fragments. You can increase the locality by allocating shards with changeable sizes. Index allocation supports sequential access to files and direct access to files, which is a common method. 2. meet the requirements of dynamic file growth and insertion and deletion. (As long as there are idle blocks) 3. Make full use of the external storage space.

Disadvantages: 1. More seek times and find space. 2. index tables bring about system overhead, such as internal and external storage space and access time.

Iv. Combination of continuous allocation and index allocation

Principle: continuous allocation is used for small files (3 or 4). When the file is large, the system automatically switches to the index allocation mode.

Direct access to files: continuous distribution is used.

Sequential File Access: links are allocated.

The access types used by these systems must be described during file creation.


5. Multiple indexes

Principle: first, Multiple indexes are also a type of index allocation, but they place the addresses of all the index tables (secondary indexes) of a large file in another index table (primary index. Ps: very similar to the fourth paradigm of the database.

Large file: If you set a disk block size to 1 kb, 100 disk blocks are required for files with a length of 100 kb, and at least items are required for the index table. If the file size is kb, the index table requires 1000 items. If the disk block number is expressed in four bytes, the index occupies at least bytes (about 4 k ).

When the file is large, there are problems: 1. A lot of disk blocks are required. 2. The index table is large. 3. The entire index table cannot be stored in the memory.

Solution: Use the multi-index table structure.


Multi-index table structure diagram:

I will briefly introduce it here for the time being. I will add some examples for you later. please correct me if there are any mistakes. Thank you!




Several questions about the operating system

Ask the related teacher
Or you can think about it.
You don't have to think too much about it.
Or, you will understand it later.
I can only answer the first question: after the call, the system will give priority to the one you set or the ones you set. If you don't set it up, the system will calculate what and then what. There is a group of operations at most, not a single operation.

What is the external storage allocation method for win7?

Don't know
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.