1

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

1
  • 4
    What do you mean be thread safety? - In node.js your code is always single threaded and hence you need not to worry about thread synchronization problems. All you need to worry is to deal with asyc calls. Commented Jan 8, 2015 at 7:41

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.