python线程的可靠性 [英] The reliability of python threads

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

问题描述

大家好,我对python线程有疑问。在任何人之前

更进一步,这不是关于线程与流程的争论,只是一个

的问题。


,python线程可靠吗?或者说,他们安全吗?我已经过去有一些奇怪的错误,我使用threading.lock来获取我的

关键部分,但我想知道这是否真的很好。


有没有人有任何确凿的证据证明python线程/锁是安全的还是不安全的?b / b

谢谢,


Carl


-


Carl J. Van Arsdall
cv ********* @ mvista.com

构建和发布

MontaVista软件

解决方案



文章< ma **** ***********************************@蟒蛇。 org>,

" Carl J. Van Arsdall" < cv ********* @ mvista.comwrites:

|大家好,我对python线程有疑问。在任何人之前

|更进一步,这不是关于线程与进程的辩论,只是一个

|问题。

|>

|有了这个,python线程可靠吗?或者说,他们安全吗?我已经

|过去有一些奇怪的错误,我使用threading.lock来获取我的

|关键部分,但我想知道这是否真的很好。

|>

|有没有人有任何确凿的证据表明python线程/锁是

|安全还是不安全?


不安全。它们建立在不安全的原语之上(POSIX,Microsoft

等)Python会保护你免受一些问题,但不是全部。


有珍贵的你可以做的很少,因为根本原因是标准和规格无可救药有缺陷。

问候,

Nick Maclaren。


2007年1月24日17:12:19 GMT,Nick Maclaren< nm ** @ cus.cam.ac.ukwrote:


>

文章< ma **************************** ***********@蟒蛇。 org>,

" Carl J. Van Arsdall" < cv ********* @ mvista.comwrites:

|大家好,我对python线程有疑问。在任何人之前

|更进一步,这不是关于线程与进程的辩论,只是一个

|问题。

|>

|有了这个,python线程可靠吗?或者说,他们安全吗?我已经

|过去有一些奇怪的错误,我使用threading.lock来获取我的

|关键部分,但我想知道这是否真的很好。

|>

|有没有人有任何确凿的证据表明python线程/锁是

|安全还是不安全?


不安全。它们建立在不安全的原语之上(POSIX,Microsoft

等)Python会保护你免受一些问题,但不是全部。


有珍贵的你可以做的很少,因为根本原因是标准和规格无可救药地存在缺陷。



这对我来说是不够准确的将其称为FUD。使用来自Python的
线程,与任何其他语言一样,需要知道线程的权衡和限制,但声称它们的使用是
本质上*不安全是不正确的。几乎可以肯定的是,你的代码和锁定是有缺陷的,而不是你下面的线程

是错误的。


< blockquote>

文章< ma *********************************** ****@蟒蛇。 org>,

" Chris Mellon" < ar ***** @ gmail.comwrites:

| |>

| |有没有人有任何确凿的证据表明python线程/锁是

| |安全还是不安全?

|

|不安全。它们建立在不安全的原语之上(POSIX,Microsoft

|等等)Python会保护你免受一些问题的影响,但不是全部。

|

|你可以做的很少,因为根本原因是

|标准和规格是无可救药的缺陷。

|>

|这是非常不准确的,我称之为FUD。使用

|来自Python的线程,从任何其他语言,需要知道

|线程的权衡和限制,但声称他们的

|用法本身*不安全是不正确的。几乎可以肯定的是

|你的代码和锁定都有缺陷,而不是你下面的线程

|都是错误的。


我建议您更多地了解

POSIX线程内存模型的错误定义,以更好地记录

方面之一。网络搜索应该为你提供更多关于可怕的混乱的信息,而不是任何理智的人想知道的。


这只是众多方面中的一个: - (

问候,

Nick Maclaren。


Hey everyone, I have a question about python threads. Before anyone
goes further, this is not a debate about threads vs. processes, just a
question.

With that, are python threads reliable? Or rather, are they safe? I''ve
had some strange errors in the past, I use threading.lock for my
critical sections, but I wonder if that is really good enough.

Does anyone have any conclusive evidence that python threads/locks are
safe or unsafe?

Thanks,

Carl

--

Carl J. Van Arsdall
cv*********@mvista.com
Build and Release
MontaVista Software

解决方案


In article <ma***************************************@python. org>,
"Carl J. Van Arsdall" <cv*********@mvista.comwrites:
|Hey everyone, I have a question about python threads. Before anyone
|goes further, this is not a debate about threads vs. processes, just a
|question.
|>
|With that, are python threads reliable? Or rather, are they safe? I''ve
|had some strange errors in the past, I use threading.lock for my
|critical sections, but I wonder if that is really good enough.
|>
|Does anyone have any conclusive evidence that python threads/locks are
|safe or unsafe?

Unsafe. They are built on top of unsafe primitives (POSIX, Microsoft
etc.) Python will shield you from some problems, but not all.

There is precious little that you can do, because the root cause is
that the standards and specifications are hopelessly flawed.
Regards,
Nick Maclaren.


On 24 Jan 2007 17:12:19 GMT, Nick Maclaren <nm**@cus.cam.ac.ukwrote:

>
In article <ma***************************************@python. org>,
"Carl J. Van Arsdall" <cv*********@mvista.comwrites:
|Hey everyone, I have a question about python threads. Before anyone
|goes further, this is not a debate about threads vs. processes, just a
|question.
|>
|With that, are python threads reliable? Or rather, are they safe? I''ve
|had some strange errors in the past, I use threading.lock for my
|critical sections, but I wonder if that is really good enough.
|>
|Does anyone have any conclusive evidence that python threads/locks are
|safe or unsafe?

Unsafe. They are built on top of unsafe primitives (POSIX, Microsoft
etc.) Python will shield you from some problems, but not all.

There is precious little that you can do, because the root cause is
that the standards and specifications are hopelessly flawed.

This is sufficiently inaccurate that I would call it FUD. Using
threads from Python, as from any other language, requires knowledge of
the tradeoffs and limitations of threading, but claiming that their
usage is *inherently* unsafe isn''t true. It is almost certain that
your code and locking are flawed, not that the threads underneath you
are buggy.



In article <ma***************************************@python. org>,
"Chris Mellon" <ar*****@gmail.comwrites:
| |>
| |Does anyone have any conclusive evidence that python threads/locks are
| |safe or unsafe?
|
| Unsafe. They are built on top of unsafe primitives (POSIX, Microsoft
| etc.) Python will shield you from some problems, but not all.
|
| There is precious little that you can do, because the root cause is
| that the standards and specifications are hopelessly flawed.
|>
|This is sufficiently inaccurate that I would call it FUD. Using
|threads from Python, as from any other language, requires knowledge of
|the tradeoffs and limitations of threading, but claiming that their
|usage is *inherently* unsafe isn''t true. It is almost certain that
|your code and locking are flawed, not that the threads underneath you
|are buggy.

I suggest that you find out rather more about the ill-definition of
POSIX threading memory model, to name one of the better documented
aspects. A Web search should provide you with more information on
the ghastly mess than any sane person wants to know.

And that is only one of many aspects :-(
Regards,
Nick Maclaren.


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

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