DEV Community

Discussion on: Some people try to solve problems using threads...

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

I agree. Multi-threading introduces a lot more complexity to your app than needed, so they should be used sparingly and only as the very last resort.

In fact, async I/O is what you need most of the time when you think that you need multi-threading. Consider that JavaScript on server side is so fast compared to traditional interpreters like PHP/Python only because of async I/O and it doesn't even need multi-threading!

Collapse
 
elmuerte profile image
Michiel Hendriks

Multi threading processing only introduces more complexity when you have mutable data.

async I/O does not solve problems which require multi threading to be solved, it solves an other problem which is made worse with multi threading. You need both; multi threading and async I/O.

Collapse
 
qm3ster profile image
Mihail Malo

Real multithreading is much better than "clustering". You just need a borrow checker :v

Collapse
 
karataev profile image
Eugene Karataev

Sometimes async I/O is not enough.
What about heavy CPU calculations? It'll block the main thread and make the application unresponsive. That's why Workers were introduced in Node 10.5.