Example #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)
Example #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)
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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)
Example #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)
Example #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
Example #11
0
def is_schedulable(no_cpus, tasks):
    return forall(tasks)(lambda t_k: task_schedulable(tasks, t_k, no_cpus))
Example #12
0
def has_bounded_tardiness(no_cpus, tasks):
    return tasks.utilization() <= no_cpus and forall(tasks)(lambda t: t.period >= t.cost)
Example #13
0
def is_schedulable(num_cpus, tasks):
    return forall(xrange(
        len(tasks)))(lambda k: rta_schedulable_guan(k, tasks, num_cpus))
Example #14
0
def has_bounded_tardiness(no_cpus, tasks):
    return tasks.utilization() <= no_cpus and \
        forall(tasks)(lambda t: t.period >= t.cost)
Example #15
0
 def only_constrained_deadlines(self):
     return forall(self)(lambda t: t.constrained_deadline())
Example #16
0
 def only_implicit_deadlines(self):
     return forall(self)(lambda t: t.implicit_deadline())
Example #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)
Example #18
0
def is_schedulable(num_cpus, tasks, **kargs):
    return forall(list(range(len(tasks))))(lambda k: rta_schedulable(k, tasks, num_cpus, **kargs))
Example #19
0
def is_schedulable(no_cpus, tasks):
    return forall(tasks)(lambda t_k: task_schedulable(tasks, t_k, no_cpus))
Example #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)
Example #21
0
def is_schedulable(num_cpus, tasks):
    return forall(xrange(len(tasks)))(lambda k: rta_schedulable_guan(k, tasks, num_cpus))
Example #22
0
 def only_constrained_deadlines(self):
     return forall(self)(lambda t: t.constrained_deadline())
Example #23
0
 def only_implicit_deadlines(self):
     return forall(self)(lambda t: t.implicit_deadline())