Overview of processes in Linux

  
 Each process in Linux is described by a task_struct data structure. In Linux, the task
(task) and the process
(process) are two identical terms, and the task_struct is actually called "ldquo;" Process control block & rdquo; that is, PCB. Task_struct holds all the information of a process, is the only means for the system to control the process, and is the most effective means.
In Linux 2.4, Linux dynamically allocates a task_struct structure for each newly created process. The maximum number of processes allowed by the system is determined by the size of the physical memory owned by the machine. For example, in the IA32 architecture, a machine with 512M memory can reach a maximum of 32K, which is the old kernel (2.2). The previous version has been greatly improved.
Linux supports multiprocessor (SMP), so multiple CPUs are allowed in the system. When Linux is used as a multiprocessor operating system
, the maximum number of CPUs allowed in the system is 32. . Obviously, when Linux is used as a stand-alone operating system, there is only one CPU in the system. This book mainly discusses the situation of a single processor.
Similar to other operating systems, Linux also supports two processes: normal processes and real-time processes. Real-time processes have a degree of urgency that requires very fast response to external events; normal processes do not. Therefore, the scheduler needs to treat the two processes differently. Usually, the real-time process runs faster than the normal process. The distinction between these two processes is also reflected in the task_struct data structure.
In short, the task_struct data structure containing all the information of the process is quite large, but the data structure itself is not complicated. We can divide all its fields according to its functions as follows:
·Process State

·Scheduling Information

·Identifiers )

· Process Communication Information (IPC: Inter_Process Communication)

·Time and Timers

·Process Link Information (Links)

· File System Information (File System)

·Virtual Memory Information (Virtual Memory)

· Page Management Information (page)

· Symmetric Multiprocessor (SMP) Information

· Processor-specific context (Processor Specific Context)

· Other information

Below we describe the task_struct structure in detail.

Copyright © Windows knowledge All Rights Reserved