📄 strategy_scheduler.h
字号:
//
// = DESCRIPTION
// Defines "schedule" method using Rate Monotonic
// Scheduling algorithm.
{
public:
ACE_RMS_Scheduler_Strategy (ACE_DynScheduler::Preemption_Priority minimum_critical_priority = 0);
// = Constructor.
virtual ~ACE_RMS_Scheduler_Strategy ();
// = Virtual destructor.
static ACE_RMS_Scheduler_Strategy *instance ();
// Returns an instance of the strategy.
virtual int priority_comp (const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Compares two dispatch entries by minimum period: returns -1 if the
// first Dispatch_Entry is greater in the order, 0 if they're equivalent,
// or 1 if the second Dispatch_Entry is greater in the order.
virtual void sort (Dispatch_Entry **dispatch_entries,
u_int count);
// = Sorts the dispatch entry link pointer array in
// descending RMS (rate) order.
virtual ACE_DynScheduler::Preemption_Priority minimum_critical_priority ();
// = Determine the minimum critical priority number.
virtual ACE_DynScheduler::Dispatching_Type
dispatch_type (const Dispatch_Entry &entry);
// = Provide the dispatching queue type for the given dispatch entry.
protected:
virtual long dynamic_subpriority (Dispatch_Entry &entry,
RtecScheduler::Time current_time);
// = Just returns 0: all operations have
// the same dynamic subpriority value.
virtual int dynamic_subpriority_comp
(const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = All dispatches in a given priority level have the same dynamic
// subpriority under RMS: just returns 0.
private:
static int sort_function (void *arg1, void *arg2);
// = Comparison function to pass to qsort: calls instance ()->sort_comp ().
static ACE_RMS_Scheduler_Strategy *instance_;
// = Instance of the strategy.
};
class TAO_RTSched_Export ACE_MLF_Scheduler_Strategy : public ACE_Scheduler_Strategy
// = TITLE
// ACE_MLF_Scheduler_Strategy
//
// = DESCRIPTION
// Defines "schedule" method using Minimum Laxity First
// scheduling algorithm.
{
public:
ACE_MLF_Scheduler_Strategy (ACE_DynScheduler::Preemption_Priority minimum_critical_priority = 0);
// = Constructor.
virtual ~ACE_MLF_Scheduler_Strategy ();
// = Virtual destructor.
static ACE_MLF_Scheduler_Strategy *instance ();
// = Returns an instance of the strategy.
virtual int priority_comp (const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Just returns 0, as all dispatch entries are of equivalent
// static priority under MLF.
virtual void sort (Dispatch_Entry **dispatch_entries,
u_int count);
// = Sorts the dispatch entry link pointer array in ascending laxity order.
virtual ACE_DynScheduler::Dispatching_Type
dispatch_type (const Dispatch_Entry &entry);
// = Provide the dispatching queue type for the given dispatch entry.
protected:
virtual long dynamic_subpriority (Dispatch_Entry &entry,
RtecScheduler::Time current_time);
// = Returns a dynamic subpriority value at the current time for
// the given timeline entry: if the operation has
// non-negative laxity, then the value is positive, and a lower
// laxity gives a higher dynamic subpriority; if the operation
// has negative laxity, the value is the (negative) laxity value.
virtual int dynamic_subpriority_comp
(const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Orders two dispatch entries by ascending laxity: returns -1 if the
// first Dispatch_Entry is greater in the order, 0 if they're equivalent,
// or 1 if the second Dispatch_Entry is greater in the order.
private:
static int sort_function (void *arg1, void *arg2);
// = Comparison function to pass to qsort: calls instance ()->sort_comp ().
static ACE_MLF_Scheduler_Strategy *instance_;
// = Instance of the strategy
};
class TAO_RTSched_Export ACE_EDF_Scheduler_Strategy : public ACE_Scheduler_Strategy
// = TITLE
// ACE_EDF_Scheduler_Strategy
//
// = DESCRIPTION
// Defines "schedule" method using Earliest Deadline First
// scheduling algorithm.
{
public:
ACE_EDF_Scheduler_Strategy (ACE_DynScheduler::Preemption_Priority minimum_critical_priority = 0);
// = Default constructor.
virtual ~ACE_EDF_Scheduler_Strategy ();
// = Virtual destructor.
static ACE_EDF_Scheduler_Strategy *instance ();
// = Returns an instance of the strategy.
virtual int priority_comp (const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Returns 0, as all dispatch entries are of equivalent
// priority under EDF.
virtual void sort (Dispatch_Entry **dispatch_entries,
u_int count);
// = Sorts the dispatch entry link pointer array
// in ascending deadline (period) order.
virtual ACE_DynScheduler::Dispatching_Type
dispatch_type (const Dispatch_Entry &entry);
// = Provide the dispatching queue type for the given dispatch entry.
protected:
virtual long dynamic_subpriority (Dispatch_Entry &entry,
RtecScheduler::Time current_time);
// = Returns a dynamic subpriority value at the current time for the
// given timeline entry: if the operation has non-negative
// time to deadline, then value is positive, and a shorter time to
// deadline gives a higher dynamic subpriority; if the operation has a
// negative time to deadline, the value is (negative) time to deadline.
virtual int dynamic_subpriority_comp
(const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Orders two dispatch entries by ascending time to deadline: returns -1
// if the first Dispatch_Entry is greater in the order, 0 if they're
// equivalent, or 1 if the second Dispatch_Entry is greater in the order.
private:
static int sort_function (void *arg1, void *arg2);
// = Comparison function to pass to qsort: calls instance ()->sort_comp ().
static ACE_EDF_Scheduler_Strategy *instance_;
// = Instance of the strategy.
};
class TAO_RTSched_Export ACE_Criticality_Scheduler_Strategy : public ACE_Scheduler_Strategy
// = TITLE
// ACE_Criticality_Scheduler_Strategy
//
// = DESCRIPTION
// Defines "schedule" method using a simple mapping directly from
// operation criticality to static priority.
{
public:
ACE_Criticality_Scheduler_Strategy (ACE_DynScheduler::Preemption_Priority minimum_critical_priority = 0);
// = Constructor.
virtual ~ACE_Criticality_Scheduler_Strategy ();
// = Virtual destructor.
static ACE_Criticality_Scheduler_Strategy *instance ();
// = Returns an instance of the strategy.
virtual int priority_comp (const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = Compares two dispatch entries by minimum period: returns -1 if the
// first Dispatch_Entry is greater in the order, 0 if they're equivalent,
// or 1 if the second Dispatch_Entry is greater in the order.
virtual void sort (Dispatch_Entry **dispatch_entries,
u_int count);
// = Sort the dispatch entry link pointer array in descending
// criticality order.
virtual ACE_DynScheduler::Preemption_Priority minimum_critical_priority ();
// = Determine the minimum critical priority number.
virtual ACE_DynScheduler::Dispatching_Type
dispatch_type (const Dispatch_Entry &entry);
// Provide the dispatching queue type for the given dispatch entry.
protected:
virtual long dynamic_subpriority (Dispatch_Entry &entry,
RtecScheduler::Time current_time);
// = Just returns 0: all operations have
// the same dynamic subpriority value.
virtual int dynamic_subpriority_comp
(const Dispatch_Entry &first_entry,
const Dispatch_Entry &second_entry);
// = All dispatches in a given priority level have the same dynamic
// subpriority under this strategy: just returns 0.
private:
static int sort_function (void *arg1, void *arg2);
// = Comparison function to pass to qsort: calls instance ()->sort_comp ().
static ACE_Criticality_Scheduler_Strategy *instance_;
// = Instance of the strategy.
};
#if defined (__ACE_INLINE__)
#include "Strategy_Scheduler.i"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* STRATEGY_SCHEDULER_H */
// EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -