[Vm-dev] Stack Cog and Heartbeat

Dimitry Golubovsky golubovsky at gmail.com
Wed Jul 6 19:00:30 UTC 2011


Hi,

What is the importance of heartbeat in Cog? What happens if heartbeat
frequency is unstable or low?

Concerning running Cog in Android: most of the time (between
screen/hardware button presses) an activity (and any of Cog code) is
just not running. I can give it periodic timer events, but if they are
too frequent then CPU load is higher therefore battery drains faster.

Cog gets control only when some external event is ready to be
processed. Plus, I am not sure whether external signals are available
to Android programs same way they are in Linux.

Is it possible to replace external signal-driven heartbeat with some
synchronous action invoked in the interpreter every N bytecodes, or
just one beat at interpreter entry, one at exit?

Sorry if my question is complete nonsense, but I feel like I need to
ask anyway ;)

Andeas' hack on classic VM (which is currently used in Android) was to
return from the interpreter once the VM internal process queue is
empty. I am thinking that instead of this I could create a special
display module, and switch in and out the VM on calls to ioGetEvent.
But classic VM did not have heartbeat, did it?

Thanks.

PS I realize that in such mode internal process management by the Cog
VM is impaired, but my goal is to use it mostly for GUI anyway and
rely more on host processes and threads.

PPS I am interested in Stack VM only since JIT for ARM may not even
exist at this moment.

-- 
Dimitry Golubovsky

Anywhere on the Web


More information about the Vm-dev mailing list