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.

    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题