Models of concurrency in nodejs

后端 未结 3 829
时光说笑
时光说笑 2020-12-05 09:48

Does anyone know what the memory and threading models are in nodejs?

In particular, is ii++ atomic? Does it behave as if ii were vola

3条回答
  •  暖寄归人
    2020-12-05 10:22

    There's only one thread (the event loop) and your code is never interrupted unless you perform an asynchronous action like I/O. You can't do any parallel code execution. Therefore ii++ is atomic.

提交回复
热议问题