English 中文(简体)
为什么单个的花on工艺使用率可能超过100%?
原标题:Why single python process s cpu usage can be more than 100 percent?

www.un.org/Depts/DGACM/index_spanish.htm 由于GIL,我认为,多面的 p光过程只有一次能够运行,因此pu用量不能超过100%。

但是,我发现,法典的灯塔可以占上层950%。

import threading
import time

def f():
    while 1:
        pass


for i in range(10):
    t = threading.Thread(target=f)
    t.setDaemon(True)
    t.start()

time.sleep(60)

这不是一个与。 在该问题上,欧佩集团说,他正在做I/O密集型载荷测试,该试验可释放国际地理信息公司。 但是,我的方案没有I/O操作。

对CPython 2.6.6进行测试。

问题回答

我认为,在这种情况下,万国邮联忙忙忙于做一些实际工作。 另一种说法是,read子的开关正在利用所有CPU来开展工作,但假装法太快,无法引起CPU的使用。 我尝试在下文中增加一些实际的计算结果,万国邮联的使用率降至约200%。 如果你增加计算,我认为万国邮联的使用将非常接近100%。

def f():
    x=1
    while 1:
        y=x*2

原因之一是,你重新使用的方法达到950%。 有一些被称作(avg)的负荷,或许不是在阅读文件之前预期的。

装载量是(平均)在运行状态或可操作状态(CPU时间点)中的read数。 例如,十座公共汽车 lo。 虽然有一只透镜正在运行,但另外9个处于可操作状态(处于一个时段)。

The load is an indication on how many cores that you could have made use of. Or how much CPU power your program wants to use (not necessarily the actual CPU power it gets to use).





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签