[Vm-dev] Tasks of the heartbeat code

Holger Freyther holger at freyther.de
Fri Dec 25 21:03:24 UTC 2015

> On 25 Dec 2015, at 21:40, Holger Freyther <holger at freyther.de> wrote:
> I have done it using the X11 plugin:
> 1.) Don't disable SIGIO for the X11 handle:
> 2.) Hack (needs to use CAS or such) ioProcessEvents. So we remember when a
> SIGIO has been received and instead of just trying to poll every nextPollUsecs we
> poll if we know it will succeed.

I think these two changes make sense by itself. For platforms we have SIGIO we
should enable it unconditionally and rely on it. The question is if we want to use
atomic operations to have "doDispatch" change to 1 when it is '0' and atomically
change it '1' to '0'?

> 3.) When the relinquish primitive is called 

> +  extern usqLong getNextWakeupUsecs();
> +  if (getNextWakeupUsecs() == 0) {
> +  	sigsuspend(&set);

This _never_ happens. It means that at least one part of the system is driven by
delays. That is a bit unfortunate for network systems (e.g. unless I use RFB I do
not need to have Morph update)

> +  } else {
> +	setitimer(ITIMER_REAL, &value, NULL);

This is something I don't understand. The interactive responsiveness is really terrible
when I stop the heart beat timer. I assume that primitiveRelinquishProcessor will not
lead to a context switch so it takes longer until a new task will be selected.

Eliot do you have the full picture between VM and Image here?  In theory after doing
1st and 2nd the VM should now more quickly call ioProcessEvents and as it is not
sleeping longer than the time to the next wake up time the interactive performance should
not have changed.

kind regards

More information about the Vm-dev mailing list