next up previous
Next: About this document Up: File Management Previous: Data Structures on

Data Structures in Memory

Each process is associated with a per-user open file table. This table has an entry for each object opened by the process, and is indexed by file descriptors.

Each entry in the open file table points to an entry in the R/W mark table, which stores the R/W marks of the open files in the system. Entries in different open file tables may point to the same R/W mark, thus allowing processes created as a result of fork or exec to share R/W marks.

Each entry in the R/W mark table points to an entry in the active inode table, which stores the inode of the file. Different entries in the R/W mark table can point to the same entry in the same active inode table, thus allowing different processes to have separate I/O marks for the same file.

Caching

Unix relies heavily on caching for efficiency. As we saw earlier, it keeps the inodes of open files in memory. In addition, it keeps the list of disk blocks that have been accessed recently in memory and obtains data from them whenever possible.

The path name to inode translation can be expensive, in particular, when it involves indirect files. Keeping the data blocks of directories recently accessed in memory speeds up this translation. The system takes other steps, in addition, to make this translation efficient.

It maintains a cache of (file name, inode) pairs. Also, it maintains a directory offset cache used in the following manner. If a process requests a file name in the same directory as its previous request, the search through the directory is started where the previous name was found.

This strategy allows efficient handling of requests made by processes such as ls that scan all files in a directory one by one.


next up previous
Next: About this document Up: File Management Previous: Data Structures on



Prasun Dewan
Wed Apr 21 11:44:11 EDT 1999