HPDCS/ROOT-Sim

The idle process doesn't have a valid lid

Closed this issue · 3 comments

The is_valid_lid macro is defined as follow:

is_valid_lid(lid) ((lid).id < n_prc)

But the idle_process has UINT_MAX as lid:

set_lid(idle_process, UINT_MAX);

The result is that the idle_process doesn't has a valid lid

In the simulator, the idle process is just an abstraction to take a bit of statistics about idle cycles, and it is intended to crash badly everything if it is ever scheduled---better than scheduling something which exists but shouldn't have been scheduled.

Is this causing trouble somewhere?

In any case, when dealing with issue #66 the overall usage of gids and lids in the code base will drop significantly. Indeed, even current_lp will be changed from LID_t to LP_State *.
In that process, the idle process will disappear, and will be replaced by a NULL state.
So if this is not causing trouble now, I would link the two issues and resolve them together later on.

The problem raises on the packet model cause of:

// No logical process found with events to be processed
if (lid_equals(lid, idle_process)) {
statistics_post_lp_data(lid, STAT_IDLE_CYCLES, 1.0);
return;
}

Good catch!
I'm patching this quickly right now.