我想知道多处理如何工作。python多处理如何工作?
这是否表示我可以同时运行8 separate process
,如果我有8 core CPU
?
例如,这里是我的处理器信息。
[email protected]:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Stepping: 7
CPU MHz: 2294.762
BogoMIPS: 4589.52
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0
这是我cpuinfo中
[email protected]:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
stepping : 7
microcode : 0x23
cpu MHz : 2294.762
cache size : 3072 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips : 4589.52
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
正如你看到的,我的CPU(S)的数量为1
。
这是否意味着多处理在我的情况下没用?
如果这是一个超线程CPU,那么您仍然可以同时运行两个进程。但总的来说,您可以同时运行,尽可能多的进程与您的计算机上的逻辑核心CPU一样多。我假设你在这种情况下有一个超线程CPU,所以多处理不应该_useless_ - 只是不_as useful_ – inspectorG4dget
请向我们展示'cat/proc/cpuinfo' – Pavel
@Pavel更新了我的问题 – Giri