summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Packing_Scheduler.h
blob: 0fd75c17ecc07952939005e00875d4049e0cd5f3 (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
// -*- C++ -*-

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

#ifndef PACKING_SCHEDULER_H_
#define PACKING_SCHEDULER_H_

#include "Scheduler.h"

typedef std::vector<TASK_LIST> TASK_LISTS;
typedef std::map <Processor, TASK_LISTS> TASK_GROUPS;

std::ostream & operator<< (std::ostream & ostr, 
                           const TASK_LISTS & tl);

std::ostream & operator<< (std::ostream & ostr, 
                           const TASK_GROUPS & tg);

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

  virtual double schedule_task (const Task & task,
                                const Processor & processor);

protected:
  virtual void update_schedule (const ScheduleResult & result);

private:
  void update_task_groups (const ScheduleResult & result);

  void add_backup (const Task & task,
                   TASK_LISTS & tg);

  bool rank_check (const TASK_LISTS & list);

  unsigned int paired_rank_check (const TASK_LIST & list1,
                                  const TASK_LIST & list2);

  bool merge_check (const TASK_LISTS & lists);

  TASK_LIST merge_lists (const TASK_LISTS & lists);

private:
  TASK_GROUPS task_groups_;
};

#endif /* PACKING_SCHEDULER_H_ */