top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is file descriptor table for a process and how it is works ?

+2 votes
366 views
What is file descriptor table for a process and how it is works ?
posted Sep 10, 2013 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
  1. File descriptor (FD) is an abstract indicator for accessing a file.
  2. Each running process has a File Descriptor Table(FDT) which contains pointers to all open i/o streams. When a process starts, three entries are created in the first three cells of the table. Entry 0 points to standard input (stdin), entry 1 points to standard output (stdout), and entry 2 points to standard error (stderr).
  3. Whenever a file or other i/o stream is opened, a new entry is created in this table, usually in the first available empty slot. The socket system call returns an entry into this table; i.e. a small integer. This value is used for other calls which use this socket. The accept system call returns another entry into this table. The value returned by accept is used for reading and writing to that connection.
answer Sep 12, 2013 by Satyabrata Mahapatra
...