摘要: 18.6使用threading模块 #!/usr/bin/env python # -*- coding:utf-8 -*- """从Thread类中派生出一个子例,创建一个这个子类的实例""" import threading from time import sleep, ctime loops = (4, 2) class MyThread(threading.Thread): ... 阅读全文
posted @ 2016-05-12 14:53 shawshanks 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 18.1没有线程支持 #!/usr/bin/env python # -*- coding:utf-8 -*- from time import sleep, ctime def loop0(): print 'start loop 0 at:', ctime() sleep(4) print 'loop 0 done at', ctime() def loop1(... 阅读全文
posted @ 2016-05-12 14:37 shawshanks 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 一进程和线程 1参考链接: http://www.zhihu.com/question/25532384 中OF小工和zhonyong 的回答 总结他们两的回答: 引言: 1.电脑的运行,在硬件上是CPU、相关寄存器、RAM之间的事情。负责处理任务的顺序有CPU决定。 2.程序的上下文:当CPU处理任务时,所需要的各种资源(显卡、寄存器等)准备完毕,构成了这个程序的执行环境,即上下文。 3.CPU... 阅读全文
posted @ 2016-05-12 14:11 shawshanks 阅读(381) 评论(0) 推荐(0) 编辑