Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do web workers work in single core machines [closed]

Can we reap the benefit of web workers, if we have single core machine? I have come across web workers are designed to work in multi-core processors environment.

like image 366
newday Avatar asked Oct 26 '25 07:10

newday


1 Answers

Multi-threading can still be a valuable organizational tool even when it is not a tool to increase performance.

Consider a long calculation that isn't easily broken up into small pieces. Running the calculation inside of a worker allows the operating system to perform scheduling for you. The process runs in the "background", the user interface stays responsive, and you don't have to rewrite your code into a bunch of setTimeout() and setInterval() calls.

like image 86
Mike Edwards Avatar answered Oct 28 '25 22:10

Mike Edwards



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!