Process

进程(Process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础。在早期面向进程设计的计算机结构中,进程是程序的基本执行实体;在当代面向线程设计的计算机结构中,进程是线程的容器。

一个进程至少包含一个线程。

Process 类用来描述一个进程对象。创建子进程的时候,只需要传入一个执行函数和函数的参数即可完成 Process 示例的创建。

Process类通过创建子进程来是实现更多的占有cpu,提高效率

在pycharm里查看下Process的源码:

 1 class Process(object):
 2     def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
 3         self.name = ''
 4         self.daemon = False
 5         self.authkey = None
 6         self.exitcode = None
 7         self.ident = 0
 8         self.pid = 0
 9         self.sentinel = None
10 
11     def run(self):
12         pass
13 
14     def start(self):
15         pass
16 
17     def terminate(self):
18         pass
19 
20     def join(self, timeout=None):
21         pass
22 
23     def is_alive(self):
24         return False
Process类

相关文章:

  • 2021-08-16
  • 2021-08-08
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-08-06
猜你喜欢
  • 2021-06-23
  • 2021-10-16
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-01-24
  • 2021-06-03
相关资源
相似解决方案