aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/edf/gedf.cpp
blob: e2a6bec54409507b6a1071a41933c781f025a0e5 (plain) (blame)
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
#include "tasks.h"
#include "schedulability.h"

#include "edf/baker.h"
#include "edf/baruah.h"
#include "edf/gfb.h"
#include "edf/bcl.h"
#include "edf/bcl_iterative.h"
#include "edf/rta.h"
#include "edf/ffdbf.h"
#include "edf/load.h"
#include "edf/gedf.h"

bool GlobalEDF::is_schedulable(const TaskSet &ts,
                               bool check)
{
    if (check)
	{
        if (!(ts.has_only_feasible_tasks() && ts.is_not_overutilized(m)))
            return false;

        if (ts.get_task_count() == 0)
            return true;
    }

    // density bound on a uniprocessor.
    if (m == 1)
    {
        fractional_t density;
        ts.get_density(density);
        if (density <= 1)
            return true;
    }

    // Baker's test can deal with arbitrary deadlines.
    // It's cheap, so do it first.
    if (BakerGedf(m).is_schedulable(ts, false))
        return true;

    // Baruah's test and the BCL and GFB tests assume constrained deadlines.
    if (ts.has_only_constrained_deadlines())
	    if (GFBGedf(m).is_schedulable(ts, false)
            || (want_rta && RTAGedf(m, rta_step).is_schedulable(ts, false))
               // The RTA test generalizes the BCL and BCLIterative tests.
            || (want_baruah && BaruahGedf(m).is_schedulable(ts, false))
            || (want_ffdbf && FFDBFGedf(m).is_schedulable(ts, false)))
            return true;

    // Load-based test can handle arbitrary deadlines.
    if (want_load && LoadGedf(m).is_schedulable(ts, false))
        return true;

    return false;
}