V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
haython
V2EX  ›  Python

multiprocessing 怎么保证进程数一直不变?

  •  
  •   haython · 2014-10-13 22:01:09 +08:00 · 3017 次点击
    这是一个创建于 3498 天前的主题,其中的信息可能已经有所发展或是发生改变。
    使用multiprocessing起多个进程,我担心有进程会挂掉,怎么防止进程挂掉,或者能检测到有进程挂掉,再起一个。注:fork的方式启动我知道如何检测,但是我想用multiprocessing
    2 条回复    2014-10-14 09:03:05 +08:00
    lushl9301
        1
    lushl9301  
       2014-10-13 22:05:59 +08:00
    main thread 一直loop?检测每个进程?
    mengzhuo
        2
    mengzhuo  
       2014-10-14 09:03:05 +08:00
    multiprocessing就是用os.fork,只是加了一些管理用的
    https://hg.python.org/cpython/file/d894aa49d5e4/Lib/multiprocessing/popen_fork.py#l70
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2251 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:57 · PVG 08:57 · LAX 17:57 · JFK 20:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.