From: Tomas Hruby Date: Thu, 12 Nov 2009 08:47:25 +0000 (+0000) Subject: No need for a special idle queue X-Git-Tag: v3.1.6~204 X-Git-Url: http://zhaoyanbai.com/repos/man.nsupdate.html?a=commitdiff_plain;h=cb9faaebfd58299da5cb50585d484ee249b66601;p=minix.git No need for a special idle queue - as the idle task is never placed on any run queue, we don't need any special idle queue. - one more queue available for user processes --- diff --git a/kernel/proc.c b/kernel/proc.c index e7a04f2aa..02e2c0e48 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -1198,7 +1198,6 @@ register struct proc *rp; /* this process is now runnable */ sched(rp, &q, &front); vmassert(q >= 0); - vmassert(q < IDLE_Q || rp->p_endpoint == IDLE); /* Now add the process to the queue. */ if (rdy_head[q] == NIL_PROC) { /* add to empty queue */ @@ -1262,7 +1261,6 @@ PRIVATE void enqueue_head(struct proc *rp) vmassert(rp->p_ticks_left); vmassert(q >= 0); - vmassert(q < IDLE_Q || rp->p_endpoint == IDLE); q = rp->p_priority; @@ -1358,7 +1356,7 @@ int *front; /* return: front or back */ */ if (! time_left) { /* quantum consumed ? */ rp->p_ticks_left = rp->p_quantum_size; /* give new quantum */ - if (rp->p_priority < (IDLE_Q-1)) { + if (rp->p_priority < (NR_SCHED_QUEUES-1)) { rp->p_priority += 1; /* lower priority */ } } diff --git a/kernel/proc.h b/kernel/proc.h index 6cb26900a..69f1124c9 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -223,9 +223,10 @@ struct proc { #define NR_SCHED_QUEUES 16 /* MUST equal minimum priority + 1 */ #define TASK_Q 0 /* highest, used for kernel tasks */ #define MAX_USER_Q 0 /* highest priority for user processes */ -#define USER_Q 7 /* default (should correspond to nice 0) */ -#define MIN_USER_Q 14 /* minimum priority for user processes */ -#define IDLE_Q 15 /* lowest, only IDLE process goes here */ +#define USER_Q (NR_SCHED_QUEUES / 2) /* default (should correspond to + nice 0) */ +#define MIN_USER_Q (NR_SCHED_QUEUES - 1) /* minimum priority for user + processes */ /* Magic process table addresses. */ #define BEG_PROC_ADDR (&proc[0]) diff --git a/kernel/table.c b/kernel/table.c index 73c19d6ff..7d068f521 100644 --- a/kernel/table.c +++ b/kernel/table.c @@ -120,7 +120,7 @@ PRIVATE int PUBLIC struct boot_image image[] = { /* process nr, pc,flags, qs, queue, stack, traps, ipcto, call, name */ -{IDLE, NULL,IDL_F, 0, IDLE_Q, IDL_S, 0, 0, no_c,"idle" }, +{IDLE, NULL,IDL_F, 0, 0, IDL_S, 0, 0, no_c,"idle" }, {CLOCK,clock_task,TSK_F, 8, TASK_Q, TSK_S, TSK_T, 0, no_c,"clock" }, {SYSTEM, sys_task,TSK_F, 8, TASK_Q, TSK_S, TSK_T, 0, no_c,"system"}, {HARDWARE, 0,TSK_F, 8, TASK_Q, HRD_S, 0, 0, no_c,"kernel"},