什么是linux进程表?它由什么组成?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4880555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the linux process table ? What does it consist of?
提问by user476033
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.
这个术语一直出现在我的操作系统笔记中,我不完全确定它是什么/它的存储位置以及如何或为什么。
采纳答案by Marcus Gründler
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.
Linux 中的进程表(例如几乎所有其他操作系统中)只是计算机 RAM 中的一个数据结构。它保存有关操作系统当前处理的进程的信息。
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).
进程表中一个非常重要的信息是每个进程当前所处的状态。该信息对于操作系统至关重要,因为它支持所谓的多处理,即仅在一个处理单元 (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:
可以在此线程中找到简短介绍:
http://www.linuxforums.org/forum/kernel/42062-use-process-table.html
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_management_(computing)#Process_description_and_control
回答by Sooryaprakhash
Process table is a data structure in Linux kernel, which store information about all currently running process. The process table contains process ID's, memory usage of the process, what are file descriptor used in the process, ect.
进程表是Linux内核中的一种数据结构,它存储了所有当前正在运行的进程的信息。进程表包含进程 ID、进程的内存使用情况、进程中使用的文件描述符等。
The kernel track the created and running process using the process descriptor. Each process descriptor contains,
内核使用进程描述符跟踪创建和运行的进程。每个进程描述符包含,
1. Identifier - process ID, parent and child process ID, user ID
2. State - process state, priority
3. Resource - CUP and Memory
The process table major information is,
进程表的主要信息是,
- Process ID
- Process User ID
- Process Priority
- Process State
- Process resource usage
- 进程标识
- 处理用户 ID
- 进程优先级
- 进程状态
- 进程资源使用
ps aux is a Linux command used to list all process status and resource usage(memory, cpu). You can see the process list with owner, PID, CPU, MEM, STAT ect.
ps aux 是一个 Linux 命令,用于列出所有进程状态和资源使用情况(内存、cpu)。您可以看到包含所有者、PID、CPU、MEM、STAT 等的进程列表。
回答by Luffy
Process table is a kernel data structurethat describes the state of a process (along with process U Area). It contains fields that must always be available to the kernel.
进程表是一个内核数据结构,它描述了一个进程的状态(连同进程 U 区)。它包含必须始终可供内核使用的字段。
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).
- state 字段(标识进程的状态)
- 允许内核在内存中定位进程及其 u 区域的字段
- 用于确定各种进程权限的 UID
- 用于指定黑白进程关系的 PID(例如 fork)
- 事件描述符(当进程处于睡眠状态时)
- 调度参数以确定进程移动到“内核运行”和“用户运行”状态的顺序
- 发送到进程但尚未处理的信号的信号字段
- 在内核模式和用户模式下提供进程执行时间的计时器
- 给出进程大小的字段(以便内核知道要为进程分配多少空间)。
In short, process table gives information about processes to the kernel.
简而言之,进程表向内核提供有关进程的信息。
回答by snr
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
For more, http://www.technologyuk.net/computing/operating-systems/
有关更多信息,请访问 http://www.technologyuk.net/computing/operating-systems/