What Is the Linux Process Table? What Does It Consist Of

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

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

Does each process has its own process table or there is just one process table that maintained by kernel only?

There is only one process table, and each process have an entry in that table and it's called a PCB, the pcb contains most of the information related to the process , ID, owner, priority, the ppid, and it also contains information that were stocked in registers if the process is switched into blocked mode, and that's extremely important because all these information are going to be recharged when the process resumes executing.

Process table in operating system

You are repeating academic nonsense in the first paragraph. In the real world PCB = "Process Context Block." That is, the CPU-defined structure that defines the state of the process. An operating system has to maintain a PCB for each process (thread). The operating system had to maintain other structures that define the process as well. There is a chain of structures that define the process beyond the PCB, such as for the virtual memory, privileges, time keeping, and whatever.

Maybe such a system exists (I have not done Linux development) but I have never done OS development on a system that has a single structure that defines a process.

In operating systems, a process started from another can either be a subprocess or a detached process. A subprocess is one that is linked to the process that created it. A detached process is one that is not linked.

If a process has subprocesses, it cannot terminate until all of its subprocesses (children) have been terminated.

Is Process Table the same thing as the Job Queue in UNIX?


Is Process Table the same thing as the Job Queue in UNIX?

No, they are not the same.

Read this textbook about operating systems; and the wikipage on processes.

The Linux OS is mostly open source. You can download (here) and study its source code, and look inside the source code of GNU bash or GNU make to understand better how syscalls(2) are used. You could also play with strace(1).

See also the kernelnewbies and OSDEV websites.

Of course, the kernel has a lot of data structures (and millions lines of source code). Read more about the kernel scheduler.

Learning Unix and C — viewing the process, file and v-node tables

I think most of what you are asking is exposed by the procfs virtual filesystem, mounted as /proc.

The top-level /proc directory contains the process ID of every running process, presented as a directory.

Within each process directory are files and sub-directories containing information for the process, and one sub-directory is /proc/XXX/fd/, which contains the files opened by the process.

Please see the following documentation for more information:

http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
http://www.thegeekstuff.com/2010/11/linux-proc-file-system/

or anything else shown when you Google "linux /proc filesystem".

Process control block vs process table?

A process control block (pcb) contains information about the process, I.e. registers, quantum, priority, etc.

The process table is an array of pcb's.

What are file descriptors, explained in simple terms?

In simple words, when you open a file, the operating system creates an entry to represent that file and store the information about that opened file. So if there are 100 files opened in your OS then there will be 100 entries in OS (somewhere in kernel). These entries are represented by integers like (...100, 101, 102....). This entry number is the file descriptor.
So it is just an integer number that uniquely represents an opened file for the process.
If your process opens 10 files then your Process table will have 10 entries for file descriptors.

Similarly, when you open a network socket, it is also represented by an integer and it is called Socket Descriptor.
I hope you understand.



Related Topics



Leave a reply



Submit