2010-11-12

timer controls

11.9: adda/co/timer controls:
. the addx app has timers that can
count elapsed time, or addx cycles:
ie, how many times has addx been called
to handle user interaction and concurrencies
-- that should be happening every 10..1000 cpu cycles?
. the ideal counter could tell an app
how much cpu time it's been given;
but,
. addx will usually be running as an app
on a multitasking system,
so it may not be easy to get addx`time
(ie, the amount of cpu time addx has received).
[11.11:
. if the platform can't provide a process`time
and addx is getting task-switched a lot,
then getting addx`time could be expensive:
. it can approximate the {suspend, resume}-times
by tracking the clock at a rate that is
significantly faster than it's being multitasked .]
uses:
. timers can be used in a loop`head
for if the algorithm is not sure to converge,
the timer can help it exit anyway .
. if a loop exits,
and its countdown timer is zero
then control knows its loop can't find
a converging solution .
. the loop can also use (~timer? raise failed),
or some other form of reporting .

No comments:

Post a Comment