Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis on the implementation of Index Node in UNIX File

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Today's Xiaobian share is about UNIX file implementation index node analysis, you may not be unfamiliar with UNIX files, or never understand UNIX files. But don't worry, today's editor will explain it in the simplest description.

POSIX does not enforce any particular representation of files on disk, but traditional UNIX files are implemented according to an improved tree structure. A directory entry contains a file name and a reference to a fixed-length structure (inode). An inode contains information about file length, file location, file owner, creation time, last access time, last modification time, and file permissions. As shown in Figure 1:

Figure 1 contains pointers to the first few blocks of data in the file, in addition to basic information. If the file is large, indirect pointers are needed. A single-level indirect pointer is a pointer to a pointer block that points to additional data blocks; a second-level indirect pointer is a pointer to a block that performs indirect knowledge; and a third-level indirect pointer block contains a pointer to a second-level indirect pointer block. For example, suppose an index node occupies 128 bytes, state information occupies 68 bytes, pointers are four bytes long, a block length is 8K bytes, and each block pointer is 32 bits. According to the above information, we can calculate (1) the number of direct pointers as: (128-68-4×3) bytes/4 bytes =12 (2) file size that pointers can directly represent: 12×8×1024=98304 bytes (3) Level 1 indirect pointer points to a block size of 8K bytes, and the number of pointers contained in an 8K byte pointer block can be 2K, and each pointer corresponds to a data block size of 8K bytes. Thus, Level 1 indirect pointer can represent file size as: 2×1024×8×1024=16 megabytes (4) Similarly, a secondary indirect index can indicate a file size of 2K×2K× 8K = 32 gigabytes. The above is the UNIX file implementation index node analysis made a brief introduction, of course, the detailed use of the above differences have to be used by everyone to understand. If you want to know more, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report