上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页
摘要: # __author: "ZXYang"# date: 2020/5/18from multiprocessing import Processimport timedef pr(name): print('process', time.ctime())if __name__ == '__main_ 阅读全文
posted @ 2020-12-21 20:54 zxy_ang 阅读(106) 评论(0) 推荐(0)
摘要: 以下内容为复制: http://blog.sina.com.cn/s/blog_b322c00f0102xieo.html Num01–>线程 线程是操作系统中能够进行运算调度的最小单位。它被包含在进程之中,是进程中的实际运作单位。 一个线程指的是进程中一个单一顺序的控制流。 一个进程中可以并发多条 阅读全文
posted @ 2020-12-21 20:34 zxy_ang 阅读(96) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# #date: 2020/5/18from multiprocessing import Processimport timeclass MyProcess(Process): def __init__(self, name): super(MyProces 阅读全文
posted @ 2020-12-20 22:39 zxy_ang 阅读(62) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/18from multiprocessing import Processimport timedef pr(name): print('process', time.ctime())if __name__ == '__main_ 阅读全文
posted @ 2020-12-20 22:38 zxy_ang 阅读(43) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/12/20"""队列:优先级队列:PriorityQueue"""import queuequ = queue.PriorityQueue()qu.put((1, '11'))qu.put((2, '22'))qu.put((-2, 阅读全文
posted @ 2020-12-20 22:19 zxy_ang 阅读(124) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/12/20"""队列:后入先出:LifoQueue"""import queuequ = queue.LifoQueue()qu.put(11)qu.put(22)qu.put(33)qu.put(44)qu.put(55)print 阅读全文
posted @ 2020-12-20 22:18 zxy_ang 阅读(226) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/12/20"""列出100个url地址(假设请求每个地址需要0.5秒)请设计程序,一个程序,访问地址列表中的url,使用四个线程发送这100个请求,计算总时间!"""import timeimport queuefrom thread 阅读全文
posted @ 2020-12-20 21:26 zxy_ang 阅读(94) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/16"""队列:先入先出:queue消息 == 任务"""import queuequ = queue.Queue(3)qu.put('a1')qu.put('a2')qu.put('a3')# qu.put('a4') # 添加 阅读全文
posted @ 2020-12-20 19:42 zxy_ang 阅读(76) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/13import threadingclass MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) # self.num 阅读全文
posted @ 2020-12-20 17:28 zxy_ang 阅读(70) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/12import threadingimport time# from time import timedef addnum(): global num lock.acquire() # 加锁,计算完后,进行下个线程,比t.joi 阅读全文
posted @ 2020-12-20 17:27 zxy_ang 阅读(132) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页