线程和多核,优点和缺点 [英] threading and multicores, pros and cons

查看:92
本文介绍了线程和多核,优点和缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试向我的客户销售python解决方案时,我遇到这是一个经常出现的问题。我知道这个问题有时会被忽视,但是这里

是市场规律。


我听说过一堆保护python选择GIL的论据,但是我不是很确定他们的技术背景,也不是什么非常重要

和什么不是。这些讨论通常以谨慎的方式结束,python已经做出了其他人的选择......这并不是真正令人信服的。


如果有些大师有做了一个很好的食谱,或想要恢复主要点

会非常感激。


问候,


-

_____________


Maric Michaud

_____________


亚里士多德 - www.aristote.info

3 place des tapis
69004里昂

电话:+33 426 880 097

手机:+33 632 77 00 21

This is a recurrent problem I encounter when I try to sell python solutions to
my customers. I''m aware that this problem is sometimes overlooked, but here
is the market''s law.

I''ve heard of a bunch of arguments to defend python''s choice of GIL, but I''m
not quite sure of their technical background, nor what is really important
and what is not. These discussions often end in a prudent "python has made a
choice among others"... which is not really convincing.

If some guru has made a good recipe, or want to resume the main points it
would be really appreciated.

regards,

--
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
Mobile: +33 632 77 00 21

推荐答案

Maric Michaud< ma *** @ aristote.infowrites:
Maric Michaud <ma***@aristote.infowrites:

如果某位大师做了一个很好的食谱,或者想要恢复要点

将非常感激。
If some guru has made a good recipe, or want to resume the main points it
would be really appreciated.



基本上Python应用程序通常不会占用太多CPU;有一些方法可以通过合理的额外努力获得并行性的一些方法;

并且对于Python的大部分历史来说,多CPU系统已经相当多了

异国情调所以GIL并没有造成太大的问题。现在它开始变得比以前更容易出现问题了,但它还没有让b $ b无法忍受。显然,在

长期运行中可能需要做些什么,可能还有PyPy。

Basically Python applications are usually not too CPU-intensive; there
are some ways you can get parallelism with reasonable extra effort;
and for most of Python''s history, multi-CPU systems have been rather
exotic so the GIL didn''t create too big a problem. Right now it is
starting to become more of a problem than before, but it''s not yet
intolerable. Obviously something will have to be done about it in the
long run, maybe with PyPy.


Le mercredi14février200705:49, Paul Rubinaécrit*:
Le mercredi 14 février 2007 05:49, Paul Rubin a écrit*:

基本上Python应用程序通常不会占用太多CPU;

是一些可以通过合理的额外努力获得并行性的方法;
Basically Python applications are usually not too CPU-intensive; there
are some ways you can get parallelism with reasonable extra effort;



基本上,虽然不是CPU密集型,但应用服务器需要从硬件的所有资源中获益。

当一个客户带着他新的漂亮​​的双核服务器并获得一个基本的安装和运行时,他会立即将它与J2EE进行比较并且

想知道为什么他应该付钱给一个顾问让它正常工作。

这时候,要解释他并不容易解释python与Java相比没有瑕疵,而且他不会后悔自己的选择。

第一印象可能是决定性的。


这里的历史解释应该是低效的,我很害怕。怎么说

这个说多线程对并行性不太好的说法呢?

足够强大吗?


-

_____________


Maric Michaud

_____________


亚里士多德 - www .aristote.info

3 place des tapis

69004里昂

电话:+33 426 880 097

手机:+33 632 77 00 21

Basically, while not CPU intensive, application server needs to get benefitof
all resources of the hardware.
When a customer comes with his new beautiful dual-core server and get a basic
plone install up and running, he will immediately compare it to J2EE and
wonder why he should pay a consultant to make it work properly.
At this time, it ''s not easy to explain him that python is not flawed compared
to Java, and that he will not regret his choice in the future.
First impression may be decisive.

The historical explanation should be inefficient here, I''m afraid. What about
the argument that said that multi threading is not so good for parallelism ?
Is it strong enough ?

--
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
Mobile: +33 632 77 00 21


Maric Michaud< ma *** @ aristote.infowrites:
Maric Michaud <ma***@aristote.infowrites:

Le mercredi14février200705:49,Paul Rubinaécrit*:
Le mercredi 14 février 2007 05:49, Paul Rubin a écrit*:

基本上Python应用程序通常不会占用太多CPU;

是一些可以通过合理的额外努力获得并行性的方法;
Basically Python applications are usually not too CPU-intensive; there
are some ways you can get parallelism with reasonable extra effort;



基本上,虽然不是CPU密集型,但应用程序服务器需要获得所有硬件资源的好处。

Basically, while not CPU intensive, application server needs to get
benefit of all resources of the hardware.



但这是不可能的 - 如果应用程序不是CPU密集型的,那么通过

定义它会留下大量可用的CPU周期。

But this is impossible--if the application is not CPU intensive, by
definition it leaves a lot of the available CPU cycles unused.


当一位顾客带来他新的漂亮​​双核服务器并且

安装并运行基本的plone时,他会立即

将它与J2EE进行比较,并想知道为什么他应该支付一名顾问才能使

正常工作。在这个时候,要解释他并不容易理解,与Java相比,
python没有缺陷,并且他将来不会后悔他的选择。第一印象可能是决定性的。
When a customer comes with his new beautiful dual-core server and
get a basic plone install up and running, he will immediately
compare it to J2EE and wonder why he should pay a consultant to make
it work properly. At this time, it ''s not easy to explain him that
python is not flawed compared to Java, and that he will not regret
his choice in the future. First impression may be decisive.



这是真的,并行性是Java领先于我们的领域。

That is true, parallelism is an area where Java is ahead of us.


历史解释在这里应该效率低下,我很害怕。那说多线程对并行性不太好的说法怎么样呢?它足够强大吗?
The historical explanation should be inefficient here, I''m
afraid. What about the argument that said that multi threading is
not so good for parallelism ? Is it strong enough ?



对于典型应用程序中的并行性来说,并不是很好,

花费大部分时间来阻止等待I / O.那是很多

的申请。它甚至可能是大多数应用程序。但是还有像bcc这样的东西,比如CPU密集型应用程序可以从并行处理中获益,并且Python在那里有一个弱点。

It''s not much good for parallelism in the typical application that
spends most of its time blocked waiting for I/O. That is many
applications. It might even even be most applications. But there are
still such things as CPU-intensive applications which can benefit from
parallelism, and Python has a weak spot there.


这篇关于线程和多核,优点和缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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