0
13kviews
Structure of U-Area and process table
1 Answer
3
570views

There are two ways to describe the information about processes, these data structures are known as kernel's "process table" and a "u-area" associated with each process.

The process table

The process table contains the information required by the kernel and the u-area holds the information required by the process itself.

The process table entry for a process, in short, is given below.

  • Process state
  • process IDs
  • User IDs for determining process privileges
  • Pointer to text structure for shared text areas
  • Pointer to a page table for memory management
  • Scheduling parameters, including the "nice" value which determines priority
  • Timers for resource usage
  • A pointer to the process u-area

The u-area

An operating system maintains a region called u-area i.e. user area which holds the specific information of process and stored in a stack segment. If the process makes a system call like system calls to write in a function main, then stack frame information for a system is stored in the stack segment.

The u-area of a process contains the following information

  • A pointer in the process table identifies the entry that corresponds to the u-area.
  • The real and effective user IDs determine various privileges allowed the process, such as file access rights.
  • Timer field records the time the process spent executing in user mode and in kernel mode.
  • An array indicates how the process wishes to react to signals.
  • The control terminal field identifies the "login terminal" associated with the process if one exists.
  • An error field records errors encountered during a system call.
  • A return value field contains the result of system calls.
  • I/O parameters describe the amount of data to transfer, the address of the source (or target) data array in user space, file offsets for I/O, and so on.
  • The current directory and current root describe the file system environment of the process.
  • The user file descriptor table records the files the process has open.
  • Limit fields restrict the size of a process and the size of a file it can write.
  • A permission modes field masks mode settings on files the process creates.

Though the process has a u-area, the kernel accesses them through its 'u' variable. It needs to access only one u-area at a time of the currently executing process. The kernel knows where the page table entry of the u-area is located. Therefore, when a process is scheduled, the physical address of its u-area is loaded into kernel page tables.

enter image description here

Fig: Structure of U-Area and process table

The first two register triples point to text and data and the third triple points to the u-area of currently running process (in this case, process D). When a context switch takes place, the entry in this fields changes and points to the u-area of the newly scheduled process. Entries 1 and 2 do not change as all the process share the kernel text and data.

Please log in to add an answer.