- Merge branch 0.3-r1003--scheduler-manage-preemption into trunk
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1023 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
cb5d958790
commit
df4b1b4205
11 changed files with 158 additions and 55 deletions
|
@ -58,3 +58,16 @@ the time slice will have to end before the former can run."""
|
|||
self.sort(queue,by_ltime)
|
||||
self.sort(queue,by_prio)
|
||||
|
||||
# manage preemption: see if we've a running thread
|
||||
# in the ready queue, and if it can still run
|
||||
if self.is_preemptive() == True:
|
||||
higher_prio = queue.get_item_at(0).get_current_priority()
|
||||
i = 0
|
||||
while i < queue.size():
|
||||
sched = queue.get_item_at(i)
|
||||
priority = sched.get_current_priority()
|
||||
if(priority != higher_prio):
|
||||
break
|
||||
if sched.get_state() == "running":
|
||||
queue.bubble_to_front(i)
|
||||
i += 1
|
||||
|
|
|
@ -53,3 +53,4 @@ Time Next in this case."""
|
|||
a.get_total_cpu_time() - a.get_elapsed_time() < \
|
||||
b.get_total_cpu_time() - b.get_elapsed_time()
|
||||
self.sort(queue,cmpf)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue