0
17kviews
UNIX kernel data structure for the process
1 Answer
2
903views

The kernel data structures play a vital role because they store data about the current state of the system. When a new process is created in the system, a kernel data structure is created as well that stores the details about that process. Most of the kernel data structures can be access by the kernel and its subsystems. They hold the data as well as pointers to other data structures.

Consider a user logging into the system, at that time, a new process arises and kernel stores the details about that process into the physical memory.

Kernel Components

The kernel stores and creates a lot of information. So it has data about which processes are running in the system, their memory requirements, files in use, etc. Kernel data structures are maintained using three important structures. These are process table, file table and v node/ i-node information.

enter image description here

Fig: Kernel Data structure

Details about these are given below:

Process Table

The process table holds information about all the processes running in the system. It is required by the kernel. These include storage information, execution status, file information, etc. Process table also stores the other entries like -

  • Process state: (When a process forks a child, its entry in the process table is duplicated including the file information and file pointers. So the parent and the child process share a file.)

  • Process ID: It is created when a new process generated and identifies the process.

  • User ID: It determines the privileges to the users for the particular process.

  • Pointer: It is a pointer to a page table for managing the memory and also a pointer to the process Uarea.

  • Timer: It is used for knowing which resource uses how much time.

File Table

A process table has a pointer which points to the file table. File table holds the entries about all the files in the computer. If multiple processes use the same file, then they contain the same file information and the file descriptor number.

Each file table entry contains information about the file such as file status (file read or file write), file offset, etc. The file offset specifies the position for next read or write into the file.

The file table also contains v-node and i-node pointers which point to the virtual node and index node respectively. These nodes contain information on how to read a file.

V-Node and i-Node Tables

Both the v-node (virtual node) and i-node (index node) are related to the storage system of the file and the storage mechanisms.

The v-node is an abstract concept (in the form of the object) that describes the interaction with file data. All file manipulation like closing a file, opening a file is done by V-node object. V-node information stored in main memory.

The i-node data structure gives information about files or directory (i.e. actual representation of files or directory). The information like the location of disk block where the file is stored, time at which file changes last, owner of the file, access permissions (read/write), etc. i-node information is stored in secondary storage.

A directory is names given to the i-nodes. A directory is in the form of parent and each of its children. List of file names and corresponding i-node number are stored in a directory entry.

Please log in to add an answer.