UVM
UVM

Reputation: 9914

Node.js and synchronization

I am thinking about using Node.js for next project. But I stuck at some point related to thread safety concept. How these issues are addressed(or need to take care) while implementing in Node.js ?

I know JavaScript supports functional programming and this paradigm will address thread-safety. What are best practices to be followed here.

Thanks

Upvotes: 1

Views: 402

Answers (1)

qqibrow
qqibrow

Reputation: 3022

Nodejs is single threaded so there will not be thread-safety issue.

Using javascript here because it's easy to write callback, which is the key for non-blocking. You have no control of when the callback will be executed, but you know it will be executed at giving time. In this way, the server will not waste time waiting for io and do more meaningful things.

I strongly suggested you visit http://nodeschool.io/ as a startpoint to learn nodejs.

Upvotes: 2

Related Questions