pick_proc() called only just before returning to userspace

- new proc_is_runnable() macro to test whether process is runnable. All tests
  whether p_rts_flags == 0 converted to use this macro

- pick_proc() calls removed from enqueue() and dequeue()

- removed the test for recursive calls from pick_proc() as it certainly cannot
  be called recursively now

- PREEMPTED flag to mark processes that were preempted by enqueueuing a higher
  priority process in enqueue()

- enqueue_head() to enqueue PREEMPTED processes again at the head of their
  current priority queue

- NO_QUANTUM flag to block and dequeue processes preempted by timer tick with
  exceeded quantum. They need to be enqueued again in schedcheck()

- next_ptr global variable removed
This commit is contained in:
Tomas Hruby
2009-11-09 17:48:31 +00:00
parent 86cc12b9a3
commit daf7940c69
6 changed files with 125 additions and 45 deletions
+2 -5
View File
@@ -278,11 +278,8 @@ PUBLIC int ap_timer_int_handler(void)
/* check if the process is still runnable after checking the vtimer */
if (p->p_rts_flags == 0 && p->p_ticks_left <= 0 &&
priv(p)->s_flags & PREEMPTIBLE) {
proc_ptr = NULL; /* no process is scheduled for dequeue and
enqueue */
dequeue(p); /* take it off the queues */
enqueue(p); /* and reinsert it again */
proc_ptr = p; /* restore some consitent state */
/* this dequeues the process */
RTS_SET(p, NO_QUANTUM);
}
return 1;