linux) file descriptor

File Descriptor

fd (file descriptor)arrayfile tabledisk0123i-node tablemodeoffset...File typeSizePermissionlink count...데이터 블록주소pointer.........file descriptor (index)

file descriptor (fd)

An integer value that distinguishes open files.

  • Managed by the kernel for each process.
  • Default file descriptors
    • 0: stdin (standard input)
    • 1: stdout (standard output)
    • 2: stderr (standard error)

file table

A table that manages various information about open files.

  • access mode: Indicates the mode in which the file was opened.
  • file offset: An offset indicating the current read or write position in the file.
  • pointer: A pointer to the actual inode.

inode

A structure containing metadata about a file.

  • Manages pointers to actual data blocks.
  • Accessed and managed via the inode number.
    • Mapped with the file name.

Reference


Post
Category
Series