- Add method to set a request state
- Work on step_forward() a little more - Add extra check inside dynamic_thread()::decrease_remaining_time() git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@717 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
dd4898ca55
commit
22af0b9cdd
5 changed files with 49 additions and 24 deletions
|
@ -68,7 +68,7 @@ static void prepare_ready_queue(ConcreteEnvironment& snapshot,
|
|||
it != all_threads.end(); it++)
|
||||
{
|
||||
if((*it)->get_state() == Schedulable::state_ready)
|
||||
all_threads.push_back(*it);
|
||||
queue.append(**it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,21 +178,28 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
|
|||
Schedulable::state_terminated)) == 0)
|
||||
simulation_ended = false;
|
||||
}
|
||||
|
||||
|
||||
// ---------- FIXME ----------------
|
||||
// What to do now if the simulation ended?
|
||||
|
||||
|
||||
|
||||
// 4a. Requests for the running thread exhausted
|
||||
// 4a. Look for exhausted requests for the running thread
|
||||
if(running_thread != NULL) {
|
||||
Requests& reqs = running_thread->get_dynamic_requests();
|
||||
if(running_thread->get_state() == Schedulable::state_terminated)
|
||||
bool running_terminated = running_thread->get_state() == Schedulable::state_terminated;
|
||||
|
||||
for(Requests::iterator it = reqs.begin(); it != reqs.end(); it++)
|
||||
{
|
||||
// for(Requests::iterator it = reqs.begin();
|
||||
}
|
||||
|
||||
DynamicRequest& rq = **it;
|
||||
if(rq.get_state() == Request::state_allocated)
|
||||
/* decrease remaining time for request */;
|
||||
|
||||
// ASK MARCO : can we implement request::decrease_remaining_time() as
|
||||
// a function that calls decrease_remaining_time() on all its subrequests,
|
||||
// that in turn never go with a remaining time < 0?
|
||||
|
||||
// If the running thread terminated uncoditionally put them in exhausted state
|
||||
if(running_terminated /* || rq.get_remaining_time() == 0 */ )
|
||||
rq.set_state(Request::state_exhausted);
|
||||
}
|
||||
|
||||
|
||||
// FIXME we lack a way to tell and/or remember for how
|
||||
// much a subrequest has been being fulfilled
|
||||
// THIS MEANS this part is NOT complete
|
||||
|
@ -205,18 +212,23 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
|
|||
// even if it was terminated
|
||||
|
||||
|
||||
}
|
||||
} //~ if running_thread != NULL
|
||||
|
||||
|
||||
// ---------- FIXME ----------------
|
||||
// What to do now if the simulation ended?
|
||||
|
||||
|
||||
// /
|
||||
// /
|
||||
// /
|
||||
// (I'M HERE) < * * * * * * * * * * *
|
||||
// \
|
||||
// \
|
||||
// \
|
||||
//
|
||||
// (is it visible enough for you?)
|
||||
/* /
|
||||
* /
|
||||
* /
|
||||
* (I'M HERE) < * * * * * * * * * * *
|
||||
* \
|
||||
* \
|
||||
* \
|
||||
*
|
||||
* (is it visible enough for you?)
|
||||
*/
|
||||
|
||||
|
||||
prepare_ready_queue(*new_snapshot, all_threads);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue