- Try to make CPUPolicy.get_parameters() and RR-Priority work. Won't

run.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@833 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-09 13:37:42 +00:00
parent addad6aa26
commit 72e562e803
8 changed files with 38 additions and 52 deletions

View file

@ -36,11 +36,6 @@ class fcfs(CPUPolicy) :
def get_time_slice(self):
return -2
# FIXME incorrect, but must be implemented to allow
# loading from the policy manager
def wants(self):
return 0
def sort_queue(self, queue):
cmpf = lambda a, b: \
a.get_arrival_time() < \

View file

@ -27,27 +27,28 @@ class rr_priority(CPUPolicy) :
pass;
def configure(self):
print 'No options to configure for rr_priority'
param = self.get_parameters()
param.register_int("Time slice", 1, 10000, True, 2)
param.register_int("Is preemptive?", 0, 1, True, 0)
def is_preemptive(self):
return False
value = self.get_parameters().get_int("Is preemptive?")
if value == 0:
return False
else:
return True
# FIXME pass to a configurable amount
def get_time_slice(self):
return 2
# FIXME incorrect, but must be implemented to allow
# loading from the policy manager
def wants(self):
return 0
return self.get_parameters().get_int("Time slice")
def sort_queue(self, queue):
by_prio = lambda a, b: \
a.get_current_priority() < \
b.get_current_priority()
by_ltime = lambda a, b: \
a.get_last_acquisition() > \
b.get_last_acquisition()
by_ltime = lambda a, b: \
a.get_last_acquisition() > \
b.get_last_acquisition()
self.sort(queue,by_ltime)
self.sort(queue,by_prio)
self.sort(queue,by_prio)

View file

@ -36,11 +36,6 @@ class sjf(CPUPolicy) :
def get_time_slice(self):
return -1
# FIXME incorrect, but must be implemented to allow
# loading from the policy manager
def wants(self):
return 0
def sort_queue(self, queue):
cmpf = lambda a, b: \
a.get_total_cpu_time() - a.get_elapsed_time() < \