# 8.7 操作进程的工具

Linux 系统提供了大量的监控和操作进程的有用工具。

* **STRACE：**&#x6253;印一个正在运行的程序和它的子进程调用的每个系统调用的轨迹。对于好奇的学生而言，这是一个令人着迷的工具。用 -static 编译你的程序，能得到一个更干净的、不带有大量与共享库相关的输出的轨迹。
* **PS：**&#x5217;出当前系统中的进程（包括僵死进程）。
* **TOP：**&#x6253;印出关于当前进程资源使用的信息。
* **PMAP：**&#x663E;示进程的内存映射。
* **/proc：**&#x4E00;个虚拟文件系统，以 ASCII 文本格式输出大量内核数据结构的内容，用户程序可以读取这些内容。比如，输入 “cat/proc/loadavg”，可以看到你的 Linux 系统上当前的平均负载。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hansimov.gitbook.io/csapp/part2/ch08-exceptional-control-flow/8.7-tools-for-manipulating-processes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
