Saturday, October 4, 2008

What is a file descriptor?

A file descriptor is an integer corresponding to the index into the file descriptor table.  The file descriptor table exists in user address space.  Each process has its own copy of the file descriptor table. Direct access to the table is not possible except via functions that uses file descriptor.

File descriptor table entry points to am entry in the system file table.  The system file table exists in the kernal space and the same table is shared by all processes.  Each entry contain the current offset, access mode and number of file descriptor pointing to it.  Each system table entry points to an entry in the in-memory inode table which represents the physical file.  Similarly, more than one entry of the system table may point to the same in-memory inode table entry.

No comments: