- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Process Representation in Linux System
Linux can manage the processes in the system, each process is represented by a task_struct C data structure. It is found in the <linux/sched.h> include file in the kernel source-code directory. The task vector is an array of pointers to every task_struct data structure in the system. As well as the normal type of process, Linux supports real time processes. All the required information i.e; the state of the process, scheduling and memory-management information, list of open files, and pointers to the process’s parent and a list of its children and siblings are contained in this structure.
A process who creates a process is called parent of that created process; its children are any processes that it creates and siblings are children with the same parent process.
Some of these fields include −
long state; /*denote state of the process */ struct sched entity se; /*denote scheduling information */ struct task struct *parent; /*denotes this process’s parent */ struct list head children; /*denotes this process’s children */ struct files struct *files; /* denotes list of open files */ struct mm struct *mm; /* denotes address space of this process */ struct task struct *p_opptr,*p_pptr,*p_cptr,*p_ysptr,*p_osptr /*denotes, op = original parent, p = parent, c = youngest child, ys = youngest sibling, os = older sibling */
All active processes are represented using a doubly linked list of task struct, within the Linux kernel. A pointer is maintained by Kernel –current-to the process currently executing on the system, as shown below −
E.g. If the system would like to change the state of the process currently running to the value new state. If current is a pointer to the process currently executing, its state is changed with the following: current->state = new state;