summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.h
blob: 6174361e835cc7e9abbbbb570684707bf6e20859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Foward_Ranking_Scheduler.h
 *
 *  $Id$
 *
 *  @author  Friedhelm Wolf (fwolf@dre.vanderbilt.edu)
 */
//=============================================================================

#ifndef FORWARD_RANKING_SCHEDULER_H_
#define FORWARD_RANKING_SCHEDULER_H_

#include "Scheduler.h"
#include "CTT_Enhanced.h"

typedef std::list<PROCESSOR_SET> PROCESSOR_SETS;

typedef std::list<TASK_LIST> TASK_SCENARIOS;

class Forward_Ranking_Scheduler : public Scheduler
{
public:
  /// default ctor
  Forward_Ranking_Scheduler (const PROCESSOR_LIST & processors,
                             unsigned int max_failures);

  virtual double schedule_task (const Task & task,
                                const Processor & processor);
private:
  bool check_for_existing_replicas (const Task & task,
                                     const Processor & processor);

  PROCESSOR_SET replica_processors (const Task & task);

  PROCESSOR_SET relevant_processors (const TASK_LIST & tasks,
                                     const PROCESSOR_SET & ignored_processors);

  PROCESSOR_SETS permute_processors (const PROCESSOR_SET & fixed,
                                     const PROCESSOR_SET & exchangeable,
                                     unsigned int failure_number);

  TASK_SCENARIOS activate_tasks (const TASK_LIST & tasks,
                                 const PROCESSOR_SETS & failures);

  double accumulate_wcrt (const TASK_SCENARIOS & scenarios);

private:
  CTT_Enhanced ctt_;
};

// streaming operators for data structures defined in this header
std::ostream & operator<< (std::ostream & ostr, 
                           const PROCESSOR_SETS & ps);

std::ostream & operator<< (std::ostream & ostr, 
                           const TASK_SCENARIOS & ts);

#endif /* FORWARD_RANKING_SCHEDULER_H_ */