Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the linux process table ? What does it consist of?

Tags:

linux

process

This term keeps appearing in my Operating System notes, and I'm not entirely sure what it is/where it's stored and how or why.

like image 745
user476033 Avatar asked Feb 02 '11 22:02

user476033


People also ask

What is process table?

The process table is a data structure maintained by the operating system to facilitate context switching and scheduling, and other activities discussed later.

What is process table and describe the process states in Linux?

The Linux Process States. In Linux, a process is an instance of executing a program or command. While these processes exist, they'll be in one of the five possible states: Running or Runnable (R) Uninterruptible Sleep (D)

What are the 5 Process states in Linux?

There are five Linux process states. They are as follows: running & runnable, interruptable_sleep, uninterruptable_sleep, stopped, and zombie. Each of these process states exist for a very well defined reason.

What are processes under Linux?

Introduction to Linux Processes A process is the execution of a program. They can be launched when opening an application or when issuing a command through the command-line terminal.


3 Answers

The process table in Linux (such as in nearly every other operating system) is simply a data structure in the RAM of a computer. It holds information about the processes that are currently handled by the OS.

This information includes general information about each process

  • process id
  • process owner
  • process priority
  • environment variables for each process
  • the parent process
  • pointers to the executable machine code of a process.

A very important information in the process table is the state in that each process currently is. This information is essential for the OS, because it enables the so called multiprocessing, i.e. the possibility to virtually run several processes on only one processing unit (CPU).

The information whether a process is currently ACTIVE, SLEEPING, RUNNING, etc. is used by the OS in order to handle the execution of processes.

Furthermore there is statistical information such as when was the process RUNNING the last time in order to enable the schedulr of the OS to decide which process should be running next.

So in summary the process table is the central organizational element for the OS to handle all the started processes.

A short introduction can be found in this thread:

https://web.archive.org/web/20190817081256/http://www.linuxforums.org/forum/kernel/42062-use-process-table.html

And wikipedia also has nice information about processes:

http://en.wikipedia.org/wiki/Process_management_(computing)#Process_description_and_control

http://en.wikipedia.org/wiki/Process_table

like image 136
Marcus Gründler Avatar answered Oct 17 '22 16:10

Marcus Gründler


Each process is represented in the operating system by a process control block - also known as task control block - which contains the following

Process management
Registers
Program counter
Program status word
Stack pointer
Process state
Priority
Scheduling parameters Process ID
Parent process
Process group
Signals
Time when process started CPU time used
Children’s CPU time
Time of next alarm

Memory management
Pointer to text segment info 
Pointer to data segment info 
Pointer to stack segment info


File management
Root directory Working directory File descriptors User ID
Group ID

enter image description here

For more, https://www.technologyuk.net/computing/computer-software/operating-systems/

like image 5
snr Avatar answered Oct 17 '22 18:10

snr


Process table is a kernel data structure that describes the state of a process (along with process U Area). It contains fields that must always be available to the kernel.

It contains following fields :

  • state field (that identifies the state of the process)
  • fields that allow kernel to locate the process and its u area in memory
  • UIDs for determining various process privileges
  • PIDs to specify relationships b/w processes (e.g. fork)
  • event descriptor (when the process in sleep state)
  • scheduling parameters to determine the order in which process moves to the states "kernel running" and "user running"
  • signal field for signals send to the process but not yet handled
  • timers that give process execution time in kernel mode and user mode
  • field that gives process size (so that kernel knows how much space to allocate for the process).

In short, process table gives information about processes to the kernel.

like image 2
Luffy Avatar answered Oct 17 '22 17:10

Luffy