2006-02-21 08:39:39 +01:00
|
|
|
from Policy import Policy
|
2006-02-23 22:50:43 +01:00
|
|
|
import sys
|
2006-02-21 08:39:39 +01:00
|
|
|
|
2006-02-21 23:57:14 +01:00
|
|
|
class fcfs(Policy) :
|
2006-02-21 08:39:39 +01:00
|
|
|
def __init__(self):
|
|
|
|
pass;
|
|
|
|
|
|
|
|
def configure(self):
|
2006-02-21 23:57:14 +01:00
|
|
|
print 'No options to configure for fcfs'
|
2006-02-21 08:39:39 +01:00
|
|
|
|
|
|
|
def is_preemptive(self):
|
|
|
|
return False
|
|
|
|
|
2006-02-22 16:16:08 +01:00
|
|
|
def get_time_slice(self):
|
|
|
|
return -1
|
2006-02-21 08:39:39 +01:00
|
|
|
|
|
|
|
def sort_queue(self, event, queue):
|
2006-02-23 22:50:43 +01:00
|
|
|
cmpf = lambda a, b: \
|
|
|
|
a.get_schedulable().get_arrival_time() < \
|
|
|
|
b.get_schedulable().get_arrival_time()
|
2006-02-23 23:02:59 +01:00
|
|
|
self.sort(queue,cmpf)
|
2006-02-23 19:55:14 +01:00
|
|
|
|