dongluan1901 2015-05-13 09:36
浏览 125

NodeJS和Go lang的单线程如何比Java的多线程更好? [关闭]

I wanna compare NodeJS, Go lang,and Java. I search about concurrency control. The result are the concurrency control of Java is multi thread, the concurrency control of NodeJS and Go lang are single thread. So, I wanna know how are Single thread of NodeJS and Go lang better than multi thread of Java ?

Can anyone help me ? Ty for every comment.

  • 写回答

1条回答 默认 最新

  • dso407787736 2015-05-13 10:15
    关注

    NodeJS is single threaded. It has event concurrency model which bring sequence of callbacks in the code. Java has true multi-threaded model where each program thread mapped on OS thread. The cost of this model is stack switch. Go is multi-threaded also but it uses user-space or 'green threads' which are mapped to one or more OS threads by runtime sheduler. Such treads are light and switch cost is less, you can spawn hundreds of thousands of go routines without any problems. With Java model you have in hand more precise control around OS resource sharing.

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?