better scheduling parameters

This commit is contained in:
David Rose 2009-01-27 03:48:05 +00:00
parent 1872148320
commit 36c0a0fd2e
2 changed files with 9 additions and 3 deletions

View File

@ -36,17 +36,22 @@ ThreadSimpleManager *ThreadSimpleManager::_global_ptr;
ThreadSimpleManager:: ThreadSimpleManager::
ThreadSimpleManager() : ThreadSimpleManager() :
_simple_thread_epoch_timeslice _simple_thread_epoch_timeslice
("simple-thread-epoch-timeslice", 0.01, ("simple-thread-epoch-timeslice", 0.05,
PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, " PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, "
"in seconds, that should be considered the " "in seconds, that should be considered the "
"typical timeslice for one epoch (to run all threads once).")), "typical timeslice for one epoch (to run all threads once).")),
_simple_thread_volunteer_delay
("simple-thread-volunteer-delay", 0.0001,
PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, "
"in seconds, for which a task that voluntarily yields should "
"be delayed.")),
_simple_thread_window _simple_thread_window
("simple-thread-window", 1.0, ("simple-thread-window", 1.0,
PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, " PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, "
"in seconds, over which to average all the threads' runtimes, " "in seconds, over which to average all the threads' runtimes, "
"for the purpose of scheduling threads.")), "for the purpose of scheduling threads.")),
_simple_thread_low_weight _simple_thread_low_weight
("simple-thread-low-weight", 0.1, ("simple-thread-low-weight", 0.2,
PRC_DESC("When SIMPLE_THREADS is defined, this determines the relative " PRC_DESC("When SIMPLE_THREADS is defined, this determines the relative "
"amount of time that is given to threads with priority TP_low.")), "amount of time that is given to threads with priority TP_low.")),
_simple_thread_normal_weight _simple_thread_normal_weight
@ -106,7 +111,7 @@ enqueue_ready(ThreadSimpleImpl *thread, bool volunteer) {
// sleep for the duration of the timeslice, so it won't interfere // sleep for the duration of the timeslice, so it won't interfere
// with timeslice accounting for the remaining ready threads. // with timeslice accounting for the remaining ready threads.
double now = get_current_time(); double now = get_current_time();
thread->_wake_time = now + _simple_thread_epoch_timeslice; thread->_wake_time = now + _simple_thread_volunteer_delay;
_volunteers.push_back(thread); _volunteers.push_back(thread);
push_heap(_volunteers.begin(), _volunteers.end(), CompareStartTime()); push_heap(_volunteers.begin(), _volunteers.end(), CompareStartTime());
} }

View File

@ -106,6 +106,7 @@ private:
public: public:
// Defined within the class to avoid static-init ordering problems. // Defined within the class to avoid static-init ordering problems.
ConfigVariableDouble _simple_thread_epoch_timeslice; ConfigVariableDouble _simple_thread_epoch_timeslice;
ConfigVariableDouble _simple_thread_volunteer_delay;
ConfigVariableDouble _simple_thread_window; ConfigVariableDouble _simple_thread_window;
ConfigVariableDouble _simple_thread_low_weight; ConfigVariableDouble _simple_thread_low_weight;
ConfigVariableDouble _simple_thread_normal_weight; ConfigVariableDouble _simple_thread_normal_weight;