第一种方式:使用os模块中的fork方式实现多进程
![1240](https://upload-images.jianshu.io/upload_images/12900126-25ed54cd752f8b8a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
输出结果:
![1240](https://upload-images.jianshu.io/upload_images/12900126-f0d1550a6e8b68ee.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
第二种方法:使用multiprocessing模块创建多进程
![1240](https://upload-images.jianshu.io/upload_images/12900126-7cdc6d23a6f00231.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
输出结果是:
![1240](https://upload-images.jianshu.io/upload_images/12900126-e72a4e6f45d85b3d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
![1240](https://upload-images.jianshu.io/upload_images/12900126-9651e9097e02ef5b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
输出结果是:
![1240](https://upload-images.jianshu.io/upload_images/12900126-5d8474f0209a0087.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
# Queue进程间通信
![1240](https://upload-images.jianshu.io/upload_images/12900126-23a2c2c330873e94.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
Queue进程间通信
![1240](https://upload-images.jianshu.io/upload_images/12900126-4f39432823ad0f79.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
输出结果:
![1240](https://upload-images.jianshu.io/upload_images/12900126-9505adf43864bb7b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
pipe进程间通信
![1240](https://upload-images.jianshu.io/upload_images/12900126-f299284eb6c00ad3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
![1240](https://upload-images.jianshu.io/upload_images/12900126-362c40206d062120.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&x-oss-process=image/resize,w_1400/format,webp)
怎么样 ?在学习中有迷茫不知如何学习的朋友小编推荐一个学Python的可以来了解一起进步一起学习!
第一种方式:使用os模块中的fork方式实现多进程
输出结果:
第二种方法:使用multiprocessing模块创建多进程
输出结果是:
输出结果是:
# Queue进程间通信
Queue进程间通信
输出结果:
pipe进程间通信
怎么样 ?在学习中有迷茫不知如何学习的朋友小编推荐一个学Python的可以来了解一起进步一起学习!