On 23 Apr 2014, at 12:18 am, Chris Double <chris.double@double.co.nz> wrote:

While low it would be good to remove this if possible. Can the
interactive scanner read loop be exited when it's no longer used? I
assume the SIGALRM usage is used for the Self scheduler. Perhaps that
could be optimized such that it's turned off if all processes are
blocked in i/o.

I think SIGALRM is also used to step morphic's polling of io. ( through worldMorph runLoop -> worldMorph delayIfNoInputFor: ms )

The runLoop method comment says: 

Don't hog the CPU by running too fast when there is
 no user input, even though there may be ongoing animation or
 monitoring activities. If we get done before consuming the
 desired frame time, sleep for the remainder of the time, checking
 for user inputs at periodic intervals. (A refinement would be
 to hang on the XEvent queue when there is no animation or
 other activity happening, but the current scheme uses extremely
 little CPU time when nothing is happening anyway.)

This is probably also the main caller of gettimeofday, which it uses to determine the time for each morphic cycle.

We can in the longer term do what the comment suggests and not poll for io, but this won't entirely fix our issue because as soon as we have an animation we will be back with SIGALRMs every few milliseconds to drive the animation.

I'll look to see whether I can find a way to turn off the interactive scanner read loop.