-3

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.

Tarkonak etak
  • 19
  • 1
  • 1

1 Answers1

12

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.

icza
  • 389,944
  • 63
  • 907
  • 827
Uvelichitel
  • 8,220
  • 1
  • 19
  • 36