jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

execatidle() runs too often and uses too much CPU #274

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run emu with single process which is doing just this:
  for(;;) sys->sleep(100);

What is the expected output? What do you see instead?
This emu will use about 2% CPU(Core) on Core2Duo 6600 @ 2.4GHz! This is too 
much and shouldn't happens.

Which operating system are you using?
Linux

Please provide any additional information below.
This happens because execatidle() called approx. 2 times per each sleep(), i.e. 
20 times per second. These 20 calls take about 0.016 sec (i.e. about 2%) on CPU 
mentioned above (and it's for emu with just one process doing nothing, so there 
is no much real work for gc yet).

That mean, each timers->init(100) result in 2% CPU loss, and complex services 
may spend about 40% CPU for just doing nothing while waiting for data from 
network to process (this is real number on my system).

Maybe it have sense to limit amount of execatidle() calls by 1-2 per second?

Original issue reported on code.google.com by powerman...@gmail.com on 31 Aug 2011 at 11:11

GoogleCodeExporter commented 9 years ago
This is patch from -npe (author is mjl, as far as I know).
I'm not sure is it correct and doesn't broke anything else, but it fix this 
issue.

Original comment by powerman...@gmail.com on 20 Sep 2011 at 7:07

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Charles....@gmail.com on 23 Sep 2011 at 12:18