From 0619414f8aa20e14b796d1932cbb48ec576d7b5c Mon Sep 17 00:00:00 2001 From: Daniel Hsu Date: Tue, 6 Jul 2004 20:26:04 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3799 --- checkin_notes | 13 +++++++++++++ client/app.C | 1 - client/cs_apps.C | 44 ++++++++++++++++++++++++++++++-------------- client/cs_trickle.C | 2 +- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/checkin_notes b/checkin_notes index a8671b190d..d4987612eb 100755 --- a/checkin_notes +++ b/checkin_notes @@ -14723,3 +14723,16 @@ Rom 6 July 2004 db_base.C sched/ handle_request.C + +Daniel 2004-07-06 + - CPU scheduler only considers resource shares for projects that have + a runnable result. + - Bound debt to [-1 day * ncpus, 1 day * ncpus] + - deleted some dead code + + client/ + app.C + cs_apps.C + cs_trickle.C + + diff --git a/client/app.C b/client/app.C index 10216d0ae8..15ce8bf855 100644 --- a/client/app.C +++ b/client/app.C @@ -121,7 +121,6 @@ ACTIVE_TASK::ACTIVE_TASK() { graphics_request_time = time(0); graphics_acked_mode = MODE_UNSUPPORTED; graphics_mode_before_ss = MODE_HIDE_GRAPHICS; - current_cpu_time = working_set_size = 0; fraction_done = 0; frac_rate_of_change = 0; diff --git a/client/cs_apps.C b/client/cs_apps.C index 04ca99786a..ab62221866 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -276,15 +276,9 @@ void CLIENT_STATE::assign_results_to_projects() { // mark selected results, so CPU scheduler won't try to consider // a result more than once (i.e. for running on another CPU) // - // also reset debts for projects that are starved (have no - // runnable result) - // for (unsigned int i=0; inext_runnable_result != NULL) + if (projects[i]->next_runnable_result != NULL) { projects[i]->next_runnable_result->already_selected = true; - else { - projects[i]->debt = 0; - projects[i]->anticipated_debt = 0; } } } @@ -344,6 +338,7 @@ bool CLIENT_STATE::schedule_cpus(bool must_reschedule) { bool some_app_started = false; double total_resource_share = 0; int retval, elapsed_time; + double max_debt = SECONDS_PER_DAY * ncpus; unsigned int i; elapsed_time = time(NULL) - cpu_sched_last_time; @@ -366,15 +361,36 @@ bool CLIENT_STATE::schedule_cpus(bool must_reschedule) { atp->next_scheduler_state = CPU_SCHED_PREEMPTED; } - // adjust project debts, reset temporary fields - for (i=0; i < projects.size(); ++i) { - total_resource_share += projects[i]->resource_share; - } + // compute total resource share among projects with runnable results + // + assign_results_to_projects(); // do this to see which projects have work for (i=0; i < projects.size(); ++i) { PROJECT *p = projects[i]; - p->debt += (p->resource_share/total_resource_share) * cpu_sched_work_done_this_period - - p->work_done_this_period; - p->anticipated_debt = p->debt; + if (p->next_runnable_result != NULL) { + total_resource_share += projects[i]->resource_share; + } + } + + // adjust project debts + // reset debts for projects with no runnable results + // reset temporary fields + for (i=0; i < projects.size(); ++i) { + PROJECT *p = projects[i]; + if (p->next_runnable_result == NULL) { + p->debt = 0; + p->anticipated_debt = 0; + } else { + p->debt += + (p->resource_share/total_resource_share) + * cpu_sched_work_done_this_period + - p->work_done_this_period; + if (p->debt < -max_debt) { + p->debt = -max_debt; + } else if (p->debt > max_debt) { + p->debt = max_debt; + } + p->anticipated_debt = p->debt; + } p->next_runnable_result = NULL; } diff --git a/client/cs_trickle.C b/client/cs_trickle.C index 3f29f9fb42..bc96af0ca4 100644 --- a/client/cs_trickle.C +++ b/client/cs_trickle.C @@ -100,7 +100,7 @@ int CLIENT_STATE::handle_trickle_down(PROJECT* project, FILE* in) { char buf[256]; char result_name[256], path[256]; string body; - int retval, send_time; + int send_time; strcpy(result_name, ""); while (fgets(buf, 256, in)) {