Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should a non-blocking code push CPU to 100%

Tags:

cpu-usage

I've been thinking today about NodeJS and it attitude towards blocking, it got me thinking, if a block of code is purely non-blocking, say calculating some real long alogirthm and variables are all present in the stack etc.. should this push a single core non hyperthreaded to CPU as Windows Task Manager defines it to 100% as it aims to complete this task as quickly as possible? Say that this is generally calculation that can take minutes.


1 Answers

Yes, it should. The algorithm should run as fast as it can. It's the operating system's job to schedule time to other processes if necessary.

like image 143
Kylotan Avatar answered Dec 05 '25 20:12

Kylotan



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!