Python论坛  - 讨论区

标题:Re: RE: [python-chinese]_我对_Python_多线程的一点理解

2005年05月27日 星期五 15:28

Carambo qutr at tjub.com.cn
Fri May 27 15:28:48 HKT 2005

¶àл´ó¼Ò£¬Ò»¸ö¶àÔµÄÒÉ»óÖÕÓڽ⿪ÁË¡£


Carambo £¬ qutr at tjub.com.cn 
2005-5-27 
----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- 
·¢¼þÈË: byj 
ÊÕ¼þÈË: python-chinese 
ʱ  ¼ä: 2005-05-27, 14:24:49
Ö÷  Ìâ: RE: [python-chinese]_ÎÒ¶Ô_Python_¶àÏ̵߳ÄÒ»µãÀí½â£¡


Äã˵µÄÎÊÌâµÄ¹Ø¼üÊÇpythonÏß³ÌÊÇ·ñ¿É°þ¶á,Ò²¾ÍÊǼ´Ê¹Ò»¸öÏ̲߳»Ö÷¶¯·ÅÆúcpu,µ÷¶ÈÕß
Ò²ÄÜ°þ¶áËüµÄÔËÐÐȨ.°´ÕÕÄã¸øµÄÉÏ˵µÄ,ÿ¸öpythonÏß³ÌÔËÐÐÒ»¸öʱ
¼äƬ,ʱ¼äƬµ½ÁË,Ëü¾Í»á±»°þ¶ácpuʹÓÃȨ,ËùÒÔÓ¦¸ÃÊÇ¿É°þ¶áµÄ.ÄãµÄÎÊÌâÓ¦¸ÃÊÇ×Ô¼º³Ì
ÐòµÄÎÊÌâ,ÓëpyhonµÄÏ̲߳ßÂÔÎÞ¹Ø.
--
Open WebMail Project (http://openwebmail.org)


---------- Original Message -----------
From: "Bruce Who" <whoonline at msn.com>
To: "python-cn-google" <python-cn at googlegroups.com>, "pythonÖÐÎÄÓʼþ×é" 
<python-chinese at lists.python.cn>
Sent: Fri, 27 May 2005 11:32:44 +0800
Subject: RE: [python-chinese] ÎÒ¶Ô Python ¶àÏ̵߳ÄÒ»µãÀí½â£¡

> µ¥¾ÍÕâÏÖÏóÀ´¿´£¬Ò²²»ÄÜÈ·¶¨¾ÍÊÇpython×ÔÉíµÄÏ̵߳÷ÊÔÎÊÌâ°É¡£Ò²ÓпÉÄÜÊÇÆäËüÔ­
Òò¡£
> 
> ======= 2005-05-27 11:22:04 Carambo wrote: =======
> 
> >Neo Chan£¬ÄãºÃ
> >ÎÒÓöµ½µÄÇé¿öÊÇÕâÑùµÄ¡£ÎÒдÁËÒ»¸öÍø¹Ø½ÓÈë³ÌÐò£¬µ÷ÓñðÈËдºÃµÄÒ»¸ödll£¬ÆäÖÐ
ÓÐÒ»¸ö·½·¨ÊÇÓÃÀ´½ÓÊÕÐÅÏ¢µÄ£¬Õâ¸ö·½·¨ÊÇÓÐÎÊÌâµÄ¡£µ±Íø¹ØûÓÐÐÅϢʱºòËü»áÒ»Ö±µÈ
´ý¡£ÕâʱËü²»ÊÍ·ÅGIL£¬¶øÎÒ»¹ÓÐÒ»¸ö·¢ËÍỊ̈߳¬µ±½ÓÊÕ½ÓÊÕÏß³ÌÒ»Ö±ÔڵȴýÐÅÏ¢µÄʱ
ºò£¬·¢ËÍÏß³ÌÆð²»À´¡£ËùÒÔÎҸоõÓÐЩÎÊÌâ¡£
> >
> >Carambo £¬ qutr at tjub.com.cn 
> >2005-5-27 
> >----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- 
> >·¢¼þÈË: Neo Chan 
> >ÊÕ¼þÈË: qutr,python-chinese 
> >ʱ ¼ä: 2005-05-27, 10:55:25
> >Ö÷ Ìâ: RE: [python-chinese] ÎÒ¶Ô Python ¶àÏ̵߳ÄÒ»µãÀí½â£¡
> >
> >
> >
> >我用过线稡¡ï¼Œæ²¡æœ‰ä½ è¯´çš„问题。。。不过我没有?#155;žè¿‡
死循环。。:ï¼?/span>
> >我认为线稡¡ä¹¡¡é—´æ˜¯åˆ†æ—¶çš„。分配时间。。即使他
æ˜?/span>while 1: 也会让他sleep一ä¸?。。去运行 両¡ä¸€ä¸ªçº¿ç¨?。ã
€?/span>
> >
> >如果你的问题不能解决。。你可以用另一种方法。。就
æ˜?/span>forkè¿¡¡ç¨¡¡ã€‚。两个è?#155;稡¡æ˜¯ä¸ä¼šå‡ºçŽ°ä½ è¯´çš„情况的ã€
‚ã€?/span>
> >
> >
> >
> >From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-
bounces at lists.python.cn] On Behalf Of Carambo
> >Sent: Friday, May 27, 2005 10:23 AM
> >To: python-chinese
> >Subject: [python-chinese] 我对 Python 多线稡¡çš„一点理解!
> >
> >python-chinese :
> >
> >  大家好!
> >
> >Python的线稡¡æ˜¯ç?font face="Times New Roman">Python的“全局解释å™
¨é”â€ï¼ˆGlobal Interpreter Lockï¼?font face="Times New Roman"> GIL)来控å
ˆ¶çš„,如果一个ç?#139;序中包含多个正在运行的线稡¡ï¼Œä»–们å
°†æ ¹æ®æŒ‡å®šçš„时间间隔依次è?#155;入和离开解释器ã€?font 
face="Times New Roman">GIL在每一时刻只运行一个线ç¨?,GIL每次å
¯ç”¨æ—¶ï¼Œéƒ½ä¼šæœ‰å•ä¸ªçº¿ç¨¡¡åŒ…含着他。(以上是ã€?font 
face="Times New Roman">Python编ç?#139;经典〡¡ä¸Šçš„一段摘录)
> >
> >按照这样的理解,就是说如果我的ç?#139;序里有一个主çº
¿ç?#139;和两个子线ç?#139;,当主线稡¡è¿è¡Œæ—¶å¯åŠ¨ä¸¤ä¸ªå­çº¿ç?
#139;,当其中的一个子线ç?#139;里有一个死循环时那么他永è
¿œå¤„于running状态,那么这时å€?font face="Times New Roman">GIL得不
到释放,那么另一个子线ç?#139;也就得不åˆ?font face="Times New 
Roman">GIL他就永远运行不起来。从这一点上说,Python的线
稡¡æ˜¯æœ‰é—®é¢˜çš„。我在实际的项ç?®ä¸­ç¡®å®žç¢°åˆ°è¿‡è¿™ä¸ªé—®é¢˜ã€?
span lang=EN-US>
> >
> >不知道大家是怎么眡¡çš„,谁能帮我?#155;´å¥½çš„理解一両¡ï¼?
> >
> >
> >
> >
> >Caramboï¼?span lang=EN-US> qutr at tjub.com.cn
> >2005-5-27 
> >_______________________________________________
> >python-chinese list
> >python-chinese at lists.python.cn
> >http://python.cn/mailman/listinfo/python-chinese
> >
> 
> = = = = = = = = = = = = = = = = = = = =
> 
> Best regards,
> 
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Bruce Who
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2005-05-27
------- End of Original Message -------

_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050527/a83458c1/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号