Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
Mukendi Mputu | 71de5bf9b5 | |
Mukendi Mputu | 317b8a1a9c | |
Mukendi Mputu | 49c1a64e52 | |
Mukendi Mputu | e398f3a492 | |
Mukendi Mputu | ae039e75be | |
Mukendi Mputu | 4a595665dc |
|
@ -12,11 +12,15 @@ import include.TasksHelper as TH
|
|||
# C_i is accessed as: tasks[i][2]
|
||||
# The number of tasks can be accessed as: tasks.shape[0]
|
||||
|
||||
|
||||
#The sufficient Test for the Hyperbolic bound
|
||||
def test(tasks):
|
||||
|
||||
#####################
|
||||
#YOUR CODE GOES HERE#
|
||||
#####################
|
||||
|
||||
return False
|
||||
""" The Hyperbolic bound is given as Π(U + 1) of all tasks: """
|
||||
# compute the hyperbolic bound as product of the U_factor of each task + 1
|
||||
hb = 1
|
||||
for i in range(tasks.shape[0]): # len(tasks) is 10
|
||||
hb *= (TH.C_i(tasks, i) / TH.P_i(tasks, i)) + 1
|
||||
# compare this computed bound to 2.0
|
||||
# if greater then no guaranty of schedulability
|
||||
# otherwise task set is schedulable
|
||||
return hb <= 2.0
|
||||
|
|
|
@ -14,9 +14,14 @@ import include.TasksHelper as TH
|
|||
|
||||
#The necessary Test for the Liu and Layland Bound
|
||||
def test(tasks):
|
||||
n = tasks.shape[0]
|
||||
U = TH.getTotalUtilization(tasks=tasks, NrTasks=n)
|
||||
U_lub = n * ((2 ** (1 / n)) - 1)
|
||||
|
||||
#####################
|
||||
#YOUR CODE GOES HERE#
|
||||
#####################
|
||||
# for fewer tasks than 10, we use the exact computed least upper bound
|
||||
# if n < 10:
|
||||
# return U <= U_lub
|
||||
|
||||
# from 10 tasks up unlimited, we use the limes of n(2 ** 1/n - 1)
|
||||
return U <= U_lub # np.log(2)
|
||||
|
||||
return False
|
||||
|
|
|
@ -13,15 +13,39 @@ import include.TasksHelper as TH
|
|||
# C_i is accessed as: tasks[i][2]
|
||||
# The number of tasks can be accessed as: tasks.shape[0]
|
||||
|
||||
#The Time Demand Analysis Test
|
||||
# The Time Demand Analysis Test
|
||||
set_num = 0
|
||||
|
||||
def test(tasks):
|
||||
#Sorting Taskset by Period/Deadline
|
||||
#This makes implementing TDA a lot easier
|
||||
# Sorting Taskset by Period/Deadline
|
||||
# This makes implementing TDA a lot easier
|
||||
shape = tasks.shape
|
||||
sortedtasks = tasks[tasks[:, 0].argsort()]
|
||||
|
||||
#####################
|
||||
#YOUR CODE GOES HERE#
|
||||
#####################
|
||||
# For each tasks in the ordered set
|
||||
|
||||
return False
|
||||
# calculate the time points for the demand function
|
||||
t_old = 10**-3
|
||||
i = 0
|
||||
|
||||
while True:
|
||||
t_new = workload_func(sortedtasks, i, t_old)
|
||||
# if the workload of task i exceeds the deadline
|
||||
if t_new > TH.D_i(sortedtasks, i):
|
||||
return False # task not schedulable
|
||||
|
||||
if t_new == t_old:
|
||||
i += 1
|
||||
t_old = 10**-3
|
||||
# chech array out of bounds
|
||||
if i == len(sortedtasks):
|
||||
return True
|
||||
t_old = t_new
|
||||
|
||||
|
||||
|
||||
def workload_func(tasks, i, t):
|
||||
sum = 0
|
||||
for k in range(i):
|
||||
sum += math.ceil(t / TH.P_i(tasks, k)) * TH.C_i(tasks, k)
|
||||
return TH.C_i(tasks, i) + sum
|
||||
|
|
Loading…
Reference in New Issue