Compare commits

...

6 Commits

Author SHA1 Message Date
Mukendi Mputu 71de5bf9b5
successully implemented TDA 2022-06-30 15:39:13 +02:00
Mukendi Mputu 317b8a1a9c
state before helpDesk 2022-06-30 14:06:36 +02:00
Mukendi Mputu 49c1a64e52
started with TDA 2022-06-28 00:26:11 +02:00
Mukendi Mputu e398f3a492
correct implementation of the LLB 2022-06-28 00:26:08 +02:00
Mukendi Mputu ae039e75be
uses TestHelp module 2022-06-28 00:26:06 +02:00
Mukendi Mputu 4a595665dc
hyperbolic sched test works 👌 2022-06-28 00:26:02 +02:00
3 changed files with 50 additions and 17 deletions

View File

@ -12,11 +12,15 @@ import include.TasksHelper as TH
# C_i is accessed as: tasks[i][2] # C_i is accessed as: tasks[i][2]
# The number of tasks can be accessed as: tasks.shape[0] # The number of tasks can be accessed as: tasks.shape[0]
#The sufficient Test for the Hyperbolic bound #The sufficient Test for the Hyperbolic bound
def test(tasks): def test(tasks):
""" 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
#YOUR CODE GOES HERE# 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
return False # compare this computed bound to 2.0
# if greater then no guaranty of schedulability
# otherwise task set is schedulable
return hb <= 2.0

View File

@ -14,9 +14,14 @@ import include.TasksHelper as TH
#The necessary Test for the Liu and Layland Bound #The necessary Test for the Liu and Layland Bound
def test(tasks): def test(tasks):
n = tasks.shape[0]
U = TH.getTotalUtilization(tasks=tasks, NrTasks=n)
U_lub = n * ((2 ** (1 / n)) - 1)
# 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)
#YOUR CODE GOES HERE# return U <= U_lub # np.log(2)
#####################
return False

View File

@ -13,15 +13,39 @@ import include.TasksHelper as TH
# C_i is accessed as: tasks[i][2] # C_i is accessed as: tasks[i][2]
# The number of tasks can be accessed as: tasks.shape[0] # 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): def test(tasks):
#Sorting Taskset by Period/Deadline # Sorting Taskset by Period/Deadline
#This makes implementing TDA a lot easier # This makes implementing TDA a lot easier
shape = tasks.shape shape = tasks.shape
sortedtasks = tasks[tasks[:, 0].argsort()] sortedtasks = tasks[tasks[:, 0].argsort()]
# For each tasks in the ordered set
##################### # calculate the time points for the demand function
#YOUR CODE GOES HERE# t_old = 10**-3
##################### i = 0
return False 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