Definition:
typedef unsigned vtime_t;
Usage example:
short_score *ss;
parent_score *ps = &ap_scoreboard_image->parent[i];
if (ss->cur_vtime != ps->last_vtime) {
/* it has made progress, so update its last_rtime,
* last_vtime */
ps->last_rtime = now;
ps->last_vtime = ss->cur_vtime;
}
else if (ps->last_rtime + ss->timeout_len < now) {
/* no progress, and the timeout length has been exceeded */
ss->timeout_len = 0;
kill(ps->pid, SIGALRM);
}
A "virtual time" is simply a counter that indicates that a child is making progress. The parent checks up on each child, and when they have made progress it resets the last_rtime element. But when the child hasn't made progress in a time that's roughly timeout_len seconds long, it is sent a SIGALRM.
Vtime is an optimization that is used only when the scoreboard is in shared memory (it's not easy/feasible to do it in a scoreboard file). The essential observation is that timeouts rarely occur, the vast majority of hits finish before any timeout happens. So it really is suboptimal to have to ask the operating system to set up and destroy alarms many times during a request.
Previous: uri_components
Next: (none)
Table of Contents
(Routines,
Structures,
Data Cells,
Constants)