thread
thread
#coding=utf-8 from multiprocessing import Pool from threading import Thread from multiprocessing import Process def loop(): while True: pass if __name__ == '__main__': for i in range(3): t = Thread(target=loop) t.start() while True: pass
process
#coding=utf-8 from multiprocessing import Pool from threading import Thread from multiprocessing import Process def loop(): while True: pass if __name__ == '__main__': for i in range(3): t = Process(target=loop) t.start() while True: pass
htop
htop explained https://peteris.rocks/blog/htop/
htop https://linuxtogether.org/htop-command-explanation/
CPU usage
- Green: Displays percentage of CPU used for processes owned by normal users.
- Red: Displays percentage of CPU used by system processes.
Memory usage
- Green: Displays percentage of RAM consumed by memory pages
- Blue: Displays percentage of RAM consumed by buffer pages
- Orange: Displays percentage of RAM consumed by cache pages
u – display all processes owned by a particular user. P – sort processes on the basis of high CPU consumption. M – sort processes on the basis of high Memory consumption.
ref
GIL 与 Python 线程的纠葛 https://www.cnblogs.com/ajianbeyourself/p/3654199.html
为什么有人说 Python 的多线程是鸡肋呢? https://www.zhihu.com/question/23474039