Пример #1
0
def mixed_task_set(tasks, factor, rate):
    allTasks = []
    for task in tasks:
        task['abnormal_exe'] = task['execution'] * factor
        task['prob'] = rate
        allTasks.append(task)
    return sort_task_set.sort(allTasks, 'period')
Пример #2
0
def pdfForm(tasks):
    allTasks = []
    for task in tasks:
        task['pdf'] = [(task['execution'], 1 - task['prob']),
                       (task['abnormal_exe'], task['prob'])]
        allTasks.append(task)
    return sort_task_set.sort(allTasks, 'period')
def mixed_task_set(tasks, factor):
    allTasks=[]
    for task in tasks:
        task.abnormal_exe = task.execution * factor
        allTasks.append(task)

    return sort_task_set.sort(allTasks, 'period')
Пример #4
0
def hardtaskWCET(tasks, hardTaskWCETFactor, rate):
    allTasks = []
    for i in range(len(tasks)):
        pos = random.randint(0, len(tasks) - 1)
        task = tasks[pos]
        task['abnormal_exe'] = task['execution'] * hardTaskWCETFactor
        task['type'] = 'hard'
        task['prob'] = rate
        allTasks.append(task)
        del tasks[pos]
    return sort_task_set.sort(allTasks, 'period')
def addPrioritiesToTasks(tasks):
    #print(tasks)

    taskPriorities = [x for x in range(len(tasks))]
    #print(taskPriorities)
    allTasks = []	
    for task in tasks:
        #adds a random priority to a task
        randomPrioIndex = random.random() * len(taskPriorities)
        task.setPriority(taskPriorities.pop(int(randomPrioIndex)) + 1)
        allTasks.append(task)
    return sort_task_set.sort(allTasks, 'priority')
Пример #6
0
def taskGeneration(tasks, hardTasks, softTasks, hardTaskPercentage,
                   hardTaskWCETFactor, softTaskWCETFactor):
    #print len(tasks)
    numberOfHardTasks = (hardTaskPercentage / 100 * len(tasks))
    #print numberOfHardTasks
    allTasks = []
    for i in range(int(numberOfHardTasks)):
        pos = random.randint(0, len(tasks) - 1)
        task = tasks[pos]
        task['abnormal_exe'] = task['execution'] * hardTaskWCETFactor
        task['type'] = 'hard'
        hardTasks.append(task)
        allTasks.append(task)
        del tasks[pos]
    for task in tasks:
        task['abnormal_exe'] = task['execution'] * softTaskWCETFactor
        task['type'] = 'soft'
        softTasks.append(task)
        allTasks.append(task)
    allTasks = hardTasks + softTasks
    hardTasks = sort_task_set.sort(hardTasks, 'period')
    softTasks = sort_task_set.sort(softTasks, 'period')
    return sort_task_set.sort(allTasks, 'period')
def add_processor_to_task( tasks, processorsNum ):
    processors = [0 for x in range(processorsNum)]

    for task in tasks:
        task.uti = task["execution"]/task["period"]

    tasks = sort_task_set.sort(tasks, "uti")
    tasks.reverse()

    for task in tasks:
        processor = lowestUtilizationProcessor(processors)

        uti = task.execution/task.period
        processors[processor] += uti
        task.processor = processor