01 2018 档案

摘要:``` from threading import Thread,current_thread from queue import Queue import time class ThreadPool: def __init__(self,n): self.queue=Queue() for i in range(n):#在线程池里面开启n个线程 ... 阅读全文
posted @ 2018-01-23 17:53 nanaindi 阅读(122) 评论(0) 推荐(0) 编辑
摘要:``` #python自带的线程池 from multiprocessing.pool import ThreadPool #注意ThreadPool不在threading模块下 from multiprocessing import Pool #导入进程池 def func(*args,**kwargs): print(args,kwargs) pool=ThreadPool(2) ... 阅读全文
posted @ 2018-01-23 17:52 nanaindi 阅读(2353) 评论(0) 推荐(0) 编辑
摘要:``` #使用池来实现并发服务器 import socket from multiprocessing import cpu_count,Pool from multiprocessing.pool import ThreadPool server=socket.socket() server.bind(('0.0.0.0',8080)) server.listen(1000) def wo... 阅读全文
posted @ 2018-01-23 17:50 nanaindi 阅读(149) 评论(0) 推荐(0) 编辑
摘要:并行的前提是要有多核CPU 阅读全文
posted @ 2018-01-17 13:49 nanaindi 阅读(108) 评论(0) 推荐(0) 编辑
摘要:1.yum y install gcc 2.下载python3.5的安装包: wget https://www.python.org/ftp/python/3.5.2/Python 3.5.2.tgz 3.解压:tar zxvf Python 3.5.2.tgz 4.cd Python 3.5.2. 阅读全文
posted @ 2018-01-09 12:56 nanaindi 阅读(178) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示