[gambit-list] Running times: real vs. CPU

Marc Feeley feeley at iro.umontreal.ca
Sun Apr 26 13:05:31 EDT 2009


On 26-Apr-09, at 12:09 PM, Taylor Venable wrote:

> On Sun, Apr 26, 2009 at 10:10:39AM -0400, Marc Feeley wrote:
>> This sounds like more than one UNIX process is running.  Can you try
>> running "top" while you execute ./a.out ?
>
> First of all, I'm on a system that looks like it has two CPUs (I have
> one of those Pentium 4 processors with hyper-threading).
>
> Looking at `top` and comparing the three aforementioned Scheme
> implementations, I see some interesting results: whereas Chicken and
> MzScheme both stay in the process running state (onproc), Gambit
> frequently does a nanosleep which forces it to go into the
> ready-to-run state (run) before it can execute again.  The Chicken and
> MzScheme impls will use the CPU that they're running on 100% but it's
> about 40% - 60% idle when running the Gambit version.

Strange indeed!  Is your program calling thread-sleep! or process- 
status?  I don't see why it would call nanosleep otherwise.  Actually  
can you send me your program?

Here's something you can try to see if it solves the problem.  At line  
798 of lib/os_io.c insert the line

#undef USE_nanosleep

You can read the comment to see why nanosleep is used here (better  
timeout resolution).

Please let me know if that solves the problem.  It would be  
interesting to know if this problem also occurs on other UNIX flavors,  
or if it is specific to Linux (which I assume you are using).  Which  
kernel is this on?

Marc




More information about the Gambit-list mailing list