The Open File Table

The Open File Table - Open Mode How the file was opened:...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
The Open File Table The process table also has a list with all the files that are opened Each open file descriptor entry contain a pointer to an open file object that contains all the information about the open file. Both the Open File Table and the Open File Objects are stored in the kernel.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Open File Table The system calls like write/read refer to the open files with an integer value called file descriptor or fd that is an index into the table. The maximum number of files descriptor per process is 32 by default but but it can be changed with the command ulimit up to 1024.
Background image of page 2
The Open File Table Open File Table 0 1 2 3 4 . . 31 Open File Object I-NODE Open Mode Offset Reference Count
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Open File Object An Open File Object contains the state of an open file. I-Node – It uniquely identifies a file in the computer. An I-nodes is made of two parts: Major number – Determines the devices Minor number –It determines what file it refers to inside the device.
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Open Mode How the file was opened: Read Only Read Write Append Open File Object Offset The next read or write operation will start at this offset in the file. Each read/write operation increases the offset by the number of bytes read/written. Reference Count It is increased by the number of file descriptors that point to this Open File Object. When the reference count reaches 0 the Open File Object is removed. The reference count is initially 1 and it is increased after fork() or calls like dup and dup2. Default Open Files When a process is created, there are three files opened by default: 0 Default Standard Input 1 Default Standard Output 2 Default Standard Error Write(1, Hello, 5) Sends Hello to stdout Write(2, Hello, 5) Sends Hello to stderr Stdin, stdout, and stderr are inherited from the parent process....
View Full Document

Page1 / 6

The Open File Table - Open Mode How the file was opened:...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online