python高级之多进程 本节内容 多进程概念 Process类 进程间通讯 进程同步 进程池 1.多进程概念 multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local and remote concurrency,effectively side-…
1.多线程:开启一个进程test.py ,占用两个cpu 共占用45%左右(top -c ,按1) 多进程:开启两个进程test.py 用两个cpu 90%*2左右 test.py # coding=utf-8 from multiprocessing import Pool # 多线程版本from multiprocessing.dummy import Pool import sys, os import time def timetask(times): while 1: pass…
进程的状态 Linux进程有7种基础状态(两种running算一种),除了traced都可以用$ps命令查看,$ps可以查看的进程状态如下,更多进程状态信息参见Linux Process VS Thread VS LWP R running or runnable (on run queue) D uninterruptible sleep (usually IO) S interruptible sleep (waiting for an event to complete) T stoppe…