NCBI C++ ToolKit
Classes | Typedefs | Functions | Variables
scheduler.cpp File Reference
#include "task_server_pch.hpp"
#include <corelib/ncbireg.hpp>
#include "scheduler.hpp"
#include "threads_man.hpp"
#include "timers.hpp"
#include "srv_stat.hpp"
+ Include dependency graph for scheduler.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.


struct  SPrtyExecQueue
struct  SPrtyExecCompare
struct  SSchedInfo


typedef intr::set_base_hook< intr::tag< SPrtyExecMap_tag >, intr::optimize_size< true > > TPrtyExecMapHook
typedef intr::set< SPrtyExecQueue, intr::base_hook< TPrtyExecMapHook >, intr::constant_time_size< false >, intr::compare< SPrtyExecCompare > > TPrtyExecMap


static SPrtyExecQueues_GetExecQueue (TPrtyExecMap &prty_map, Uint4 priority)
static void s_AddTaskToQueue (SSrvThread *thr, CSrvTask *task, bool boost=false)
static CSrvTasks_UnqueueTask (SSchedInfo *sched)
static bool s_IsThreadOverloaded (SSrvThread *thr, Uint4 max_coef)
static SSrvThreads_FindQueueThread (TSrvThreadNum prefer_num, SSrvThread *cur_thr)
static void s_BalanceTasks (SSchedInfo *sched, SSrvThread *cur_thr)
static void s_FindRebalanceTasks (SSrvThread *cur_thr)
void SchedCheckOverloads (void)
static void s_ResetExecTime (SSchedInfo *sched)
static void s_ResetMaxTasks (SSchedInfo *sched)
void SchedStartJiffy (SSrvThread *thr)
bool SchedIsAllIdle (void)
static void s_DoTermination (CSrvTask *task)
void MarkTaskTerminated (CSrvTask *task, bool immediate)
static void s_MarkTaskRunning (CSrvTask *task)
static void s_MarkTaskExecuted (CSrvTask *task, SSrvThread *thr)
void SchedExecuteTask (SSrvThread *thr)
void ConfigureScheduler (const CNcbiRegistry *reg, CTempString section)
bool ReConfig_Scheduler (const CTempString &section, const CNcbiRegistry &reg, string &)
void WriteSetup_Scheduler (CSrvSocketTask &task)
Uint4 GetDefaultTaskPriority (void)
void AssignThreadSched (SSrvThread *thr)
void ReleaseThreadSched (SSrvThread *thr)


static Uint4 s_MaxTasksCoef = 1
static Uint4 s_MaxTaskLatency = 500
static int s_IdleStopTimeout = 300
static Uint4 s_TaskPriorityDefault = 1
SSrvThread ** s_Threads
Uint8 s_CurJiffies
CSrvTime s_JiffyTime

Typedef Documentation

◆ TPrtyExecMap

typedef intr::set<SPrtyExecQueue, intr::base_hook<TPrtyExecMapHook>, intr::constant_time_size<false>, intr::compare<SPrtyExecCompare> > TPrtyExecMap

Definition at line 77 of file scheduler.cpp.

◆ TPrtyExecMapHook

typedef intr::set_base_hook<intr::tag<SPrtyExecMap_tag>, intr::optimize_size<true> > TPrtyExecMapHook

Definition at line 44 of file scheduler.cpp.

Function Documentation

◆ AssignThreadSched()

void AssignThreadSched ( SSrvThread thr)

Definition at line 593 of file scheduler.cpp.

References SSchedInfo::cnt_signal, SSchedInfo::max_tasks, CFutex::SetValueNonAtomic(), and thr.

Referenced by s_AllocThread().

◆ ConfigureScheduler()

void ConfigureScheduler ( const CNcbiRegistry reg,
CTempString  section 

◆ GetDefaultTaskPriority()

Uint4 GetDefaultTaskPriority ( void  )

◆ MarkTaskTerminated()

void MarkTaskTerminated ( CSrvTask task,
bool  immediate 

◆ ReConfig_Scheduler()

bool ReConfig_Scheduler ( const CTempString section,
const CNcbiRegistry reg,
string err_message 

Definition at line 573 of file scheduler.cpp.

References IRegistry::GetInt(), and s_TaskPriorityDefault.

Referenced by CTaskServer::ReConfig().

◆ ReleaseThreadSched()

void ReleaseThreadSched ( SSrvThread thr)

◆ s_AddTaskToQueue()

static void s_AddTaskToQueue ( SSrvThread thr,
CSrvTask task,
bool  boost = false 

◆ s_BalanceTasks()

static void s_BalanceTasks ( SSchedInfo sched,
SSrvThread cur_thr 

◆ s_DoTermination()

static void s_DoTermination ( CSrvTask task)

◆ s_FindQueueThread()

static SSrvThread* s_FindQueueThread ( TSrvThreadNum  prefer_num,
SSrvThread cur_thr 

◆ s_FindRebalanceTasks()

static void s_FindRebalanceTasks ( SSrvThread cur_thr)

◆ s_GetExecQueue()

static SPrtyExecQueue* s_GetExecQueue ( TPrtyExecMap prty_map,
Uint4  priority 

Definition at line 118 of file scheduler.cpp.

References SPrtyExecQueue::priority.

Referenced by s_AddTaskToQueue().

◆ s_IsThreadOverloaded()

static bool s_IsThreadOverloaded ( SSrvThread thr,
Uint4  max_coef 

Definition at line 214 of file scheduler.cpp.

References s_CurJiffies, and thr.

Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().

◆ s_MarkTaskExecuted()

static void s_MarkTaskExecuted ( CSrvTask task,
SSrvThread thr 

◆ s_MarkTaskRunning()

static void s_MarkTaskRunning ( CSrvTask task)

Definition at line 484 of file scheduler.cpp.

References ACCESS_ONCE, AtomicCAS(), fTaskQueued, fTaskRunning, CSrvTask::m_TaskFlags, and SRV_FATAL.

Referenced by SchedExecuteTask().

◆ s_ResetExecTime()

static void s_ResetExecTime ( SSchedInfo sched)

◆ s_ResetMaxTasks()

static void s_ResetMaxTasks ( SSchedInfo sched)

◆ s_UnqueueTask()

static CSrvTask* s_UnqueueTask ( SSchedInfo sched)

◆ SchedCheckOverloads()

void SchedCheckOverloads ( void  )

◆ SchedExecuteTask()

void SchedExecuteTask ( SSrvThread thr)

◆ SchedIsAllIdle()

bool SchedIsAllIdle ( void  )

◆ SchedStartJiffy()

void SchedStartJiffy ( SSrvThread thr)

◆ WriteSetup_Scheduler()

void WriteSetup_Scheduler ( CSrvSocketTask task)

Variable Documentation

◆ s_CurJiffies

Uint8 s_CurJiffies

Definition at line 53 of file time_man.cpp.

Referenced by s_IsThreadOverloaded().

◆ s_IdleStopTimeout

int s_IdleStopTimeout = 300

Definition at line 107 of file scheduler.cpp.

Referenced by ConfigureScheduler(), SchedStartJiffy(), and WriteSetup_Scheduler().

◆ s_JiffyTime

CSrvTime s_JiffyTime

Definition at line 54 of file time_man.cpp.

Referenced by SchedExecuteTask(), and SchedIsAllIdle().

◆ s_MaxTaskLatency

Uint4 s_MaxTaskLatency = 500

Definition at line 106 of file scheduler.cpp.

Referenced by ConfigureScheduler(), s_ResetMaxTasks(), and WriteSetup_Scheduler().

◆ s_MaxTasksCoef

Uint4 s_MaxTasksCoef = 1

Definition at line 105 of file scheduler.cpp.

Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().

◆ s_TaskPriorityDefault

Uint4 s_TaskPriorityDefault = 1

◆ s_Threads

SSrvThread** s_Threads
Modified on Sun Mar 03 03:16:16 2024 by rev. 669887