Navigation

    云、贵、川、渝IT人的圈子
    • Register
    • Login
    • Search
    • 主页
    • 问答
    • 话题
    • 热门
    • 圈子
    • 招聘
    • 活动
    • 项目

    nodejs 中的 worker_threads 和 child_process 有什么区别

    技术答疑
    2
    2
    28
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • q464824151
      q464824151 last edited by

      我想在一个进程中运行其它js文件,看到nodejs 中有这两个模块,貌似都可以运行js文件,但是不知道用哪个好,它们之间都有什么区别?

      1 Reply Last reply Reply Quote 0
      • 纯
        纯清青春梦 last edited by

        worker_threads 是线程,而 child_process 是进程,
        主要区别
        线程消耗资源小,进程消耗资源大
        线程在进程下面,主进程挂到,线程也会挂掉,
        而进程与进程是独立的,一个进程中断不影响另外一个进程的执行
        线程和进程之间数据通讯比较容易,而进程与进程之间数据通讯会麻烦一点

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        纯
        8
        玻
        U
        A
        大
        A
        青
        黑
        低
        天
        白
        快
        爱
        白
        美
        此
        荒
        为
        哭
        柳
        无
        真

        社群
        昆明网页设计交流吧
        友情链接
        • Funtask
        • Funtask 社区
        • SUWIS
        • 云南北大青鸟
        ©2019-2020 滇ICP备20006698号