Ejemplo n.º 1
0
def is_schedulable(no_cpus, tasks):
    """Simple utilization bound: tasks.utilization() <= no_cpus.
    Assumption: all parameters are quantum multiples and deadlines
    are not constrained.
    """
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.deadline >= t.period >= t.cost)
Ejemplo n.º 2
0
def is_schedulable(no_cpus, tasks):
    """Simple utilization bound: tasks.utilization() <= no_cpus.
    Assumption: all parameters are quantum multiples and deadlines
    are not constrained.
    """
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.deadline >= t.period >= t.cost)
Ejemplo n.º 3
0
def is_schedulable_py(
    no_cpus, tasks, rta_min_step=1, want_baruah=3000, want_rta=True, want_ffdbf=False, want_load=False
):
    if tasks.utilization() > no_cpus or not forall(tasks)(lambda t: t.period >= t.cost):
        # trivially infeasible
        return False
    else:
        not_arbitrary = tasks.only_constrained_deadlines()
        if no_cpus == 1 and tasks.density() <= 1:
            # simply uniprocessor density condition
            return True
        elif no_cpus > 1:
            # Baker's test can handle arbitrary deadlines.
            if bak_test(no_cpus, tasks):
                return True
            # The other tests cannot.
            if not_arbitrary:
                # The density test is cheap, try it first.
                if gfb_test(no_cpus, tasks):
                    return True
                # Ok, try the slower ones.
                if should_use_baruah_test(want_baruah, tasks, no_cpus) and bar_test(no_cpus, tasks):
                    return True
                if want_rta and rta_test(no_cpus, tasks, min_fixpoint_step=rta_min_step):
                    return True
                # FF-DBF is almost always too slow.
                if want_ffdbf and ffdbf_test(no_cpus, tasks):
                    return True
    # If we get here, none of the tests passed.
    return False
Ejemplo n.º 4
0
def is_schedulable(m, tasks):
    """Are the given tasks schedulable on m processors?"""
    if tasks.utilization() >= m or not forall(tasks)(lambda t: t.constrained_deadline()):
        return False
    for (tsk_k, a_k_bound) in izip(tasks, ak_bounds(tasks, m)):
        for a_k in tasks.dbf_points_of_change(a_k_bound, offset=tsk_k.deadline):
            if not task_schedulable_for_offset(tasks, tsk_k, a_k, m):
                return False
    return True
Ejemplo n.º 5
0
def is_schedulable(m, tasks):
    """Are the given tasks schedulable on m processors?"""
    if tasks.utilization() >= m or not forall(tasks)(lambda t: t.constrained_deadline()):
        return False
    for (tsk_k, a_k_bound) in izip(tasks, ak_bounds(tasks, m)):
        for a_k in all_dbf_points_of_change_dk(tasks, a_k_bound, tsk_k.deadline):
            if not task_schedulable_for_offset(tasks, tsk_k, a_k, m):
                return False
    return True
Ejemplo n.º 6
0
def bound_response_times(no_cpus, tasks, preemptive=True):
    # DA's work applies to implicit-deadline tasks
    assert forall(tasks)(lambda t: t.implicit_deadline())

    x = task_tardiness_bound(no_cpus, tasks, preemptive)
    if x is None:
        return False
    else:
        for t in tasks:
            t.response_time = t.deadline + t.cost + x
        return True
Ejemplo n.º 7
0
def bound_response_times(no_cpus, tasks, preemptive=True):
    # DA's work applies to implicit-deadline tasks
    assert forall(tasks)(lambda t: t.implicit_deadline())

    x = task_tardiness_bound(no_cpus, tasks, preemptive)
    if x is None:
        return False
    else:
        for t in tasks:
            t.response_time = t.deadline + t.cost + x
        return True
Ejemplo n.º 8
0
def compute_response_details(no_cpus, tasks, rounds):
    if (no_cpus == 1) and forall(tasks)(lambda t: t.prio_pt == t.period):
        details = AnalysisDetails(tasks)
        details.bounds = [task.period for task in tasks]
        details.S_i = [0.0 for task in tasks]
        details.G_i = [0.0 for task in tasks]
        return details
    if schedcat.sched.using_native:
        native_ts = schedcat.sched.get_native_taskset(tasks)
        gel_obj = native.GELPl(no_cpus, native_ts, rounds)
        return AnalysisDetails(tasks, gel_obj)
    else:
        return compute_response_bounds(no_cpus, tasks, rounds)
Ejemplo n.º 9
0
def compute_response_details(no_cpus, tasks, rounds):
    if (no_cpus == 1) and forall(tasks)(lambda t: t.pp == t.period):
        details = AnalysisDetails(tasks)
        details.bounds = [task.period for task in tasks]
        details.S_i = [0.0 for task in tasks]
        details.G_i = [0.0 for task in tasks]
        return details
    if schedcat.sched.using_native:
        native_ts = schedcat.sched.get_native_taskset(tasks)
        gel_obj = native.GELPl(no_cpus, native_ts, rounds)
        return AnalysisDetails(tasks, gel_obj)
    else:
        return compute_response_bounds(no_cpus, tasks, rounds)
Ejemplo n.º 10
0
def is_schedulable_py(no_cpus,
                      tasks,
                      rta_min_step=1,
                      want_baruah=3000,
                      want_rta=True,
                      want_ffdbf=False,
                      want_load=False):
    if tasks.utilization() > no_cpus or \
        not forall(tasks)(lambda t: t.period >= t.cost):
        # trivially infeasible
        return False
    else:
        not_arbitrary = tasks.only_constrained_deadlines()
        if no_cpus == 1 and tasks.density() <= 1:
            # simply uniprocessor density condition
            return True
        elif no_cpus > 1:
            # Baker's test can handle arbitrary deadlines.
            if bak_test(no_cpus, tasks):
                return True
            # The other tests cannot.
            if not_arbitrary:
                # The density test is cheap, try it first.
                if gfb_test(no_cpus, tasks):
                    return True
                # Ok, try the slower ones.
                if should_use_baruah_test(want_baruah, tasks, no_cpus) and \
                    bar_test(no_cpus, tasks):
                    return True
                if want_rta and \
                    rta_test(no_cpus, tasks,
                             min_fixpoint_step=rta_min_step):
                    return True
                # FF-DBF is almost always too slow.
                if want_ffdbf and ffdbf_test(no_cpus, tasks):
                    return True
    # If we get here, none of the tests passed.
    return False
Ejemplo n.º 11
0
def is_schedulable(no_cpus, tasks):
    return forall(tasks)(lambda t_k: task_schedulable(tasks, t_k, no_cpus))
Ejemplo n.º 12
0
def has_bounded_tardiness(no_cpus, tasks):
    return tasks.utilization() <= no_cpus and forall(tasks)(lambda t: t.period >= t.cost)
Ejemplo n.º 13
0
def is_schedulable(num_cpus, tasks):
    return forall(xrange(
        len(tasks)))(lambda k: rta_schedulable_guan(k, tasks, num_cpus))
Ejemplo n.º 14
0
def has_bounded_tardiness(no_cpus, tasks):
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.period >= t.cost)
Ejemplo n.º 15
0
 def only_constrained_deadlines(self):
     return forall(self)(lambda t: t.constrained_deadline())
Ejemplo n.º 16
0
 def only_implicit_deadlines(self):
     return forall(self)(lambda t: t.implicit_deadline())
Ejemplo n.º 17
0
def has_bounded_tardiness(no_cpus, tasks):
    """Simple utilization bound: tasks.utilization() <= no_cpus.
    This is also true for constrained-deadline tasks.
    """
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.period >= t.cost)
Ejemplo n.º 18
0
def is_schedulable(num_cpus, tasks, **kargs):
    return forall(list(range(len(tasks))))(lambda k: rta_schedulable(k, tasks, num_cpus, **kargs))
Ejemplo n.º 19
0
def is_schedulable(no_cpus, tasks):
    return forall(tasks)(lambda t_k: task_schedulable(tasks, t_k, no_cpus))
Ejemplo n.º 20
0
def has_bounded_tardiness(no_cpus, tasks):
    """Simple utilization bound: tasks.utilization() <= no_cpus.
    This is also true for constrained-deadline tasks.
    """
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.period >= t.cost)
Ejemplo n.º 21
0
def is_schedulable(num_cpus, tasks):
    return forall(xrange(len(tasks)))(lambda k: rta_schedulable_guan(k, tasks, num_cpus))
Ejemplo n.º 22
0
 def only_constrained_deadlines(self):
     return forall(self)(lambda t: t.constrained_deadline())
Ejemplo n.º 23
0
 def only_implicit_deadlines(self):
     return forall(self)(lambda t: t.implicit_deadline())