How to store a data file system? How is it stored? -- [Sky Original], sky Original

Source: Internet
Author: User

How to store a data file system? How is it stored? -- [Sky Original], sky Original
Block Device File: indicates a file system's high-speed cache device, such as a hard drive device file: indicates a non-high-speed cache device, such as a tape drive, mouse, and System TerminalSo how can we store a piece of data in a file system? How is it stored?Generally, we think that a file is the data information of a file, which is stored on a disk. If we simply understand this, the information related to each file will be put on the index node, for example, if a character device is a character device file, it also has its permissions, group, size, Update Time, and other information that belongs to the file, if the size of a file is 1 kb, the actual size of the file to be copied must be larger than 1 kb, it also needs to copy the index node. When we copy a file, it also copies the index node of the file, not to say that the file is just a file. It also has an index node and a v node, in the memory area of the Linux kernel, there will be an offset pointer for different files from the index node. Read and Write operations will all operate on this pointer, so we will change the offset pointer for file operations, so we will start a V node on the Linux kernel and place the file offset pointer on the V node, V node --> index node --> file index nodes and files are stored on disks, and v nodes are stored in the memory area of the Linux kernel. If the file is closed, the V node is closed, but the index node is not. If the file is deleted, the index node is deleted. As for how to access the file, the system calls the API. We always say that the API is the same as calling the c library function, this understanding is wrong. let's first talk about the API? Application Programming Interface (Application Programming Interface) can be seen in English as an Interface for Application Programming. An API is a function interface (MMI) implemented by the kernel. The Gui is a graphical interface. The graphic user interface's application layer generally calls an API through an interface to interact with the kernel, the kernel then interacts with the hardware through the driver and the application and the kernel. We need to call the hardware device, so we need to call the API, although the API is also a function, it is actually a program running on the kernel. If the application layer needs to operate hardware, it must pass through the kernel, you also need to call the API and then the kernel can use the driver to operate the hardware. We can use opendir () and related functions to obtain the directory structure information and call stat () through the system () you can obtain file information from the index node. You can use common file operation functions, such as open () and read (), to access file data. Please refer to the source for reprinting.

Sina Blog: http://blog.sina.com.cn/u/2049150530
Blog: http://www.cnblogs.com/sky-heaven/
Know: http://www.zhihu.com/people/zhang-bing-hua

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.