Commit bc7921dd by PE Hladik

debug LLF and MLLF schdulers

parent 0a8e2202
......@@ -6,25 +6,22 @@ class LLF(Scheduler):
"""Least Laxity First"""
def init(self):
self.ready_list = []
self.timer = Timer(self.sim, LLF.compute_laxity,
self.timer = Timer(self.sim, LLF.update,
(self, self.processors[0]), 1, one_shot=False,
cpu=self.processors[0], overhead=.01)
cpu=self.processors[0], overhead=.001)
self.timer.start()
def compute_laxity(self, cpu):
def update(self, cpu):
if self.ready_list:
for job in self.ready_list:
job.laxity = job.absolute_deadline - \
(job.ret + self.sim.now_ms())
cpu.resched()
def on_activate(self, job):
self.ready_list.append(job)
self.compute_laxity(job.cpu)
job.cpu.resched()
def on_terminated(self, job):
self.ready_list.remove(job)
self.compute_laxity(job.cpu)
self.update(job.cpu)
def schedule(self, cpu):
decisions = []
......
......@@ -8,20 +8,17 @@ class MLLF(Scheduler):
self.ready_list = []
self.timer = None
def compute_laxity(self, cpu):
def update(self, cpu):
if self.ready_list:
for job in self.ready_list:
job.laxity = (job.absolute_deadline - job.ret) * \
self.sim.cycles_per_ms - self.sim.now()
cpu.resched()
def on_activate(self, job):
self.ready_list.append(job)
self.compute_laxity(job.cpu)
job.cpu.resched()
def on_terminated(self, job):
self.ready_list.remove(job)
self.compute_laxity(job.cpu)
self.update(job.cpu)
def schedule(self, cpu):
decisions = []
......@@ -45,7 +42,7 @@ class MLLF(Scheduler):
if self.timer:
self.timer.stop()
self.timer = Timer(
self.sim, MLLF.compute_laxity,
self.sim, MLLF.update,
(self, self.processors[0]), dmin - ta.laxity,
one_shot=True,
cpu=self.processors[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment