[Python]Running multiprocessing
2024-09-08 19:36:43
import multiprocessing as mp
import time def name_and_time(name,num):
print(f"Hello {name}, current time is {time.time()} ({num})")
print('Sleeping for 2 seconds ...')
time.sleep(2)
print("After sleeping ... exiting function") if __name__ == '__main__':
process_list = list() for i in range(100):
process = mp.Process(target=name_and_time,args=('Andrei',i))
process_list.append(process) for p in process_list:
p.start() for p in process_list:
p.join() print('Other instructions of the main module....')
print('End of Script')
最新文章
- 【腾讯Bugly干货分享】微信终端跨平台组件 Mars 系列 - 我们如约而至
- linux 登录档配置分析
- ASP.NET MVC 请求流程:Controller
- 时间:UTC时间、GMT时间、本地时间、Unix时间戳
- Oracle Goldengate和Oracle Data Integrator的初步认识
- 常见的Activity Action Intent常量
- C Primer Plus之C预处理器和C库
- Spring4.0学习笔记(1) —— 基础知识
- hdu1358Period
- createThread和_beginthreadex区别
- 正则表达式过滤HTML、JS、CSS
- 学会用git真的很重要
- webpack代码分离 ensure 看了还不懂,你打我(转)
- VS与Windbg调试
- 干货型up主
- python -- 内置模块02
- 使用jQuery+huandlebars防止编码注入攻击
- Prometheus Redis_exporter
- 1.23 codeforces div3 C.Nice Garland
- _itemmod_extract_enchant随机附魔提取