专用于Python的CPU核心? [英] Dedicated CPU core for Python?

查看:102
本文介绍了专用于Python的CPU核心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的读者,


我想知道,如果Python在未来的未来将为解释器分配一个
CPU核心,那么繁重的Python操作是不是
减慢了操作系统的速度?


它对我来说就像是对CPU内核的完美使用=)


Lots of love,

Louise

Dear readers,

I was wondering, if Python in the foerseeable future will allocate one
CPU core just for the interpreter, so heavy Python operations does
slow down the OS?

It seams to me like a perfect use for a CPU core =)

Lots of love,
Louise

推荐答案

Louise Hoffman写道:
Louise Hoffman wrote:

我想知道,如果Python在未来的将来会为解释器分配一个

的CPU内核,那么繁重的Python操作就会这样做。
放慢操作系统的速度?
I was wondering, if Python in the foerseeable future will allocate one
CPU core just for the interpreter, so heavy Python operations does
slow down the OS?



当运行脚本或加载模块时,Python并不真正表现为
作为解释器。相反,它将人类可读的代码编译为

字节码,然后在虚拟机上运行。

-

Michael Hoffman(不关系)

When running scripts, or loading modules, Python does not really behave
as an interpreter. Instead it compiles the human-readable code to a
bytecode which it then runs on a virtual machine.
--
Michael Hoffman (no relation)


2007年4月26日星期四09:16,Louise Hoffman写道:
On Thursday 26 April 2007 09:16, Louise Hoffman wrote:

亲爱的读者,


我想知道,如果Python在未来的未来将为解释器分配一个

的CPU核心,那么繁重的Python操作就会这样做。 $ b减慢了操作系统的速度?


它对我来说就像是对CPU内核的完美使用=)
Dear readers,

I was wondering, if Python in the foerseeable future will allocate one
CPU core just for the interpreter, so heavy Python operations does
slow down the OS?

It seams to me like a perfect use for a CPU core =)



Are你在谈论CPU亲和力

http:// en。 wikipedia.org/wiki/Processor_affinity )或者一个可以执行
目录的实际CPU执行Python字节码?如果是前者,CPython现在只使用一个

CPU核心,因为它的线程都是内部的,并且不会产生

系统线程(IIRC)。如果是后者,我认为这样做不会很好,因为那样,例如,C扩展就不会很好,因为它们可以

不是由Python Byte-code CPU执行。


j


-

Joshua Kugler

首席系统管理员 - 高级程序员
http://www.eeinternet.com

PGP密钥: http://pgp.mit.edu / ?* ID 0xDB26D7CE

-

通过免费的Usenet帐户从 http://www.teranews.com

Are you talking about CPU affinity
(http://en.wikipedia.org/wiki/Processor_affinity) or an actual CPU that can
directory execute Python byte code? If the former, CPython only uses one
CPU core right now because it''s threads are all internal, and do not spawn
system threads (IIRC). If the latter, I don''t think that would work very
well because then, e.g., C extensions wouldn''t work very well as they could
not be executed by a Python Byte-code CPU.

j

--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ?*ID 0xDB26D7CE

--
Posted via a free Usenet account from http://www.teranews.com


Michael Hoffman写道:
Michael Hoffman wrote:

Louise Hoffman写道:
Louise Hoffman wrote:

>我想知道,如果Python在未来的未来会分配一个只用于解释的CPU核心呃,如此繁重的Python操作会降低操作系统的速度?
>I was wondering, if Python in the foerseeable future will allocate one
CPU core just for the interpreter, so heavy Python operations does
slow down the OS?




当运行脚本或加载模块时,Python并不真正表现为
作为翻译。相反,它将人类可读的代码编译为

字节码,然后在虚拟机上运行。



When running scripts, or loading modules, Python does not really behave
as an interpreter. Instead it compiles the human-readable code to a
bytecode which it then runs on a virtual machine.



自从UCSD Pascal,大约1977年以来,口译员的工作方式就是这样。

极少数直接源解释器,源处理重新处理

每次执行一行时,仍然使用。最初的IBM PC

有ROM中的一个。 Everbody将代码研磨成某种形式的树形表示,并且通常将树表示为字符串

堆栈机器的操作。然后一个小的解释器运行堆栈机器
。这通常比执行编译到真实机器的
代码慢10-100倍。


我在Galil工业中看到了一个真正的源解释器

马达控制器最近于2004年,但这是该过时技术的少数剩余用途之一。当文件

说评论需要时间来执行时,你已经找到了其中一件

古董。


John Nagle

That''s how interpreters have worked since UCSD Pascal, circa 1977.
Very few direct source interpreters, where the source is reprocessed
each time a line is executed, are still used. The original IBM PC
had one of those in ROM. Everbody grinds the code down to some kind
of tree representation, and usually represents the tree as a string
of operations for a stack machine. Then a little intepreter runs
the stack machine. This is typically 10-100x slower than executing
code compiled to the real machine.

I saw a true source interpreter in a Galil industrial
motor controller as recently as 2004, but that''s one of the few
remaining uses for that obsolete technology. When the documentation
says that comments take time to execute, you''ve found one of those
antiques.

John Nagle


这篇关于专用于Python的CPU核心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆