Unix File System: How are file names translated to disk sectors?

后端 未结 2 944
挽巷
挽巷 2020-12-20 07:30

A very basic question. What is the exact sequence of steps executed when I try to open a file-descriptor, by providing fully-qualified path to the file.

I am lookin

2条回答
  •  醉酒成梦
    2020-12-20 08:24

    Kernel executes the following steps when we call "open(filepath)":

    1. convert the filename to inode.
    2. allocate a new file table entry for the inode, initialize various stuff(per process).
    3. allocate user file descriptor entry and store into the file table entry(global data structure).
    4. return user file descriptor to caller.

    For complete information on internal algorithm you may want to refer the great great classic book "The Design Of UNIX Operating System" By Maurice J Bach which describes these concepts and the implementation in detailed way.

提交回复
热议问题