一道python的线程题?
bestchenwu写得挺好地,
http://bestchenwu.iteye.com/blog/1063401
又找了一篇ibm的
http://www.ibm.com/developerworks/cn/aix/library/au-threadingpython/
想做1亿次系统调用,比如
-----------一下摘抄ibm那个源码-----------
蛋疼的ibm文章空格让我调试了半天#!/usr/bin/env python#hello_threads.pyimport osimport threadingimport datetimeclass ThreadClass(threading.Thread): def __init__(self,mycount): threading.Thread.__init__(self) self.mycount=mycount def run(self): os.system('tcrmgr put -port 11211 10.1.224.171 wtesthao'+str(self.mycount)+' ning')def main():# now = datetime.datetime.now() for i in range(100000): t = ThreadClass(i) t.start()if __name__=="__main__": main()1 楼 bestchenwu 2011-06-02 问题1:用线程拆分?10000个线程,每个循环10000次?
咋写?嫩行不?
呵呵 Python虚拟机跟Java虚拟机一样,都有可允许的最大线程数的。貌似JAVA是1000