& Lt; advanced programming in UNIX environment & gt; file sharing and fork functions, unixfork

Source: Internet
Author: User

<Advanced programming in UNIX environment> file sharing and fork functions, unixfork

The UNIX system supports sharing and opening files between different processes. The kernel uses three data structures to open files. The relationship between them determines the possible impact of one process on another process in file sharing.

The kernel maintains three tables, namely the input table, file table, and v node table. The details are as follows:

 

1> each process has a record in the progress table. The record contains an open file descriptor table, and each descriptor occupies one item. Associated with each file descriptor is:

A. file descriptor flag (close_on_exec );

B. pointer to a file table item.

 

2> the kernel maintains a file table for all opened files. Each file table item includes:

A. File status signs (reading, writing, adding, synchronization, and non-blocking );

B. Current file offset;

C. pointer to the table entry of the file v node.

 

3> each open file (or device) has a v-node structure. The v node contains the file type and pointers for various operation functions on the file. For most files, the v node also contains the I node (I-node, index node) of the file. This information is used to read files from the disk into the memory. The I node contains the file owner, file length, and pointer to the location of the actual data block of the file on the disk. (In UNIX file systems

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.