scheduling - time quantum in miliseconds

- Currently the cpu time quantum is timer-ticks based. Thus the
  remaining quantum is decreased only if the processes is interrupted
  by a timer tick. As processes block a lot this typically does not
  happen for normal user processes. Also the quantum depends on the
  frequency of the timer.

- This change makes the quantum miliseconds based. Internally the
  miliseconds are translated into cpu cycles. Everytime userspace
  execution is interrupted by kernel the cycles just consumed by the
  current process are deducted from the remaining quantum.

- It makes the quantum system timer frequency independent.

- The boot processes quantum is loosely derived from the tick-based
  quantas and 60Hz timer and subject to future change

- the 64bit arithmetics is a little ugly, will be changes once we have
  compiler support for 64bit integers (soon)
This commit is contained in:
Tomas Hruby
2010-05-25 08:06:14 +00:00
parent ac14a989b3
commit 451a6890d6
17 changed files with 188 additions and 102 deletions

View File

@@ -63,6 +63,7 @@ PRIVATE clock_t realtime = 0; /* real time clock */
* The boot processor timer interrupt handler. In addition to non-boot cpus it
* keeps real time and notifies the clock task if need be
*/
extern unsigned ooq_msg;
PUBLIC int bsp_timer_int_handler(void)
{
unsigned ticks;
@@ -76,7 +77,6 @@ PUBLIC int bsp_timer_int_handler(void)
realtime += ticks;
ap_timer_int_handler();
assert(!proc_is_runnable(proc_ptr) || proc_ptr->p_ticks_left > 0);
/* if a timer expired, notify the clock task */
if ((next_timeout <= realtime)) {
@@ -201,14 +201,7 @@ PUBLIC int ap_timer_int_handler(void)
p->p_user_time += ticks;
#if DEBUG_RACE
/* With DEBUG_RACE, every process gets interrupted. */
p->p_ticks_left = 0;
#else
if (priv(p)->s_flags & PREEMPTIBLE) {
p->p_ticks_left -= ticks;
}
#endif
/* FIXME make this ms too */
if (! (priv(p)->s_flags & BILLABLE)) {
billp->p_sys_time += ticks;
}
@@ -243,9 +236,6 @@ PUBLIC int ap_timer_int_handler(void)
/* Update load average. */
load_update();
/* check if the processes still have some ticks left */
check_ticks_left(p);
return 1;
}