Myr*_*tle 0 python raspberry-pi
我知道您可以使用不同的终端运行多个脚本,但是必须有一个限制。我不能只在一个小圆周上跑一百万。所以真正的问题是...有没有办法检查我的脚本的要求。先感谢您!
pi零瓦特/ python 3
忽略由于内存和CPU消耗而造成的明显限制,如果您在Raspberry PI上运行基于Linux的操作系统,则可以检查的内容/proc/sys/kernel/pid_max。从手册页:
/proc/sys/kernel/pid_max (since Linux 2.5.34)
This file specifies the value at which PIDs wrap around (i.e.,
the value in this file is one greater than the maximum PID).
PIDs greater than this value are not allocated; thus, the
value in this file also acts as a system-wide limit on the
total number of processes and threads. The default value for
this file, 32768, results in the same range of PIDs as on ear?
lier kernels. On 32-bit platforms, 32768 is the maximum value
for pid_max. On 64-bit systems, pid_max can be set to any
value up to 2^22 (PID_MAX_LIMIT, approximately 4 million).
Run Code Online (Sandbox Code Playgroud)
换句话说:在大多数默认配置下,Linux最多可以同时运行32,768个进程(和线程,合计)。请注意,您正在与系统上运行的所有其他功能(包括操作系统本身的某些部分)共享这些PID。
因此,假设您默认情况下有150个进程和线程正在运行,并且脚本使用的CPU和内存量可忽略不计,并且仅使用一个线程,那么您最多可以同时运行32,618个脚本实例。