Error in user YAML: (<unknown>): found a tab character that violate indentation while scanning a plain scalar at line 3 column 3
---
- oeasy Python 0270
- 这是 oeasy 系统化 Python 教程,从基础一步步讲,扎实、完整、不跳步。愿意花时间学,就能真正学会。
- 本教程同步发布在:
- 个人网站: `https://oeasy.org`
- 蓝桥云课: `https://www.lanqiao.cn/courses/3584`
- GitHub: `https://github.com/overmind1980/oeasy-python-tutorial`
- Gitee: `https://gitee.com/overmind1980/oeasypython`
---- 进程查询
ps -lf查看 本终端相关的 进程信息ps -elf查看 所有进程的 信息
- 杀死 进程
kill -9 PID给进程发送死亡信号
- 后台 运行
nohup python3 show.py>>s.log &
- 这些进程之间 是什么关系呢?🤔
#!/usr/bin/python
i = 0
import time
while True:
i = i + 1
print(i, "===", time.asctime())
time.sleep(1)python3 show.py >> s.log &
- zsh进程相关的 3 个进程
- zsh
- 当前的 shell环境
- zsh进程
- python3 sleep.py
- 输出时间的python程序
- zsh
- 可以观察进程(process)的细节吗?
ps -lf
- 查询进程的ps进程
- 能把结果输出到文件吗?
- 先 输出重定向到process
- 再打开process
ps -lf > process
vi process
- 效果
- 可以查看到
- 这进程之间有父子关系
pid是指进程的id- process id
ppid是指 父进程 id- parent process id
ppid是pid的爸爸
- 进程有多大呢?
ps和python3- 都是
zsh的子进程
- 都是
- python3这个进程 的 SZ什么意思?
man ps
- 查看ps的手册manual
/SZ
- 进程核心镜像的物理页数
- 占内存大小(SZ)
- 4863 个 Page
- 如果每个 page 多大 呢?
- 具体需要多少内存呢?
- 占内存大小(SZ)
- 这个vsz 和 rss 分别是什么意思?
- q退出manual
ps -o pid,ppid,sz,vsz,rss,cmd- 观察
- SZ 是欲分配的 内存
- 用 页(4K) 来当单位
- VSZ 是欲分配的内存
- 用 K 来当单位
- RSS 非交换区的内存 用 K 来当单位
- 也就是说 实际这个进程 也就
- 9180K/1024
- 8.94M
- 8M+
- python3.8 这个文件 在内存多大?
ls -lh /usr/bin/python3.8
- python3.8 这个文件
- 不是本身 已经 5.3M
- 为什么 在内存里 还变大了?
- 除了 基础部分(内建 模块函数)之外
- print()
- ord()、chr()
- int()、hex()、bin()
- 还有 新加载的部分
show.pyimport进来的time这个module
- time属于内建(built-in)的module
- 能看看内存里面具体长什么样子吗??🤔
- 我们下次再说!👋
- 本文来自 oeasy Python 系统教程。
- 想完整、扎实学 Python,
- 搜索 oeasy 即可。














