Rewrite of process scheduling:

- current and maximum priority per process;
- quantum size and current ticks left per process;
- max number of full quantums in a row allow
  (otherwise current priority is decremented)
This commit is contained in:
Jorrit Herder
2005-06-30 15:55:19 +00:00
parent ebd38d9a92
commit bac6068857
15 changed files with 235 additions and 177 deletions

View File

@@ -49,8 +49,8 @@ register message *m_ptr; /* pointer to request message */
rpc->p_ntf_q = NULL; /* remove pending notifications */
/* Only one in group should have SIGNALED, child doesn't inherit tracing. */
rpc->p_flags |= NO_MAP; /* inhibit process from running */
rpc->p_flags &= ~(SIGNALED | SIG_PENDING | P_STOP);
rpc->p_rts_flags |= NO_MAP; /* inhibit process from running */
rpc->p_rts_flags &= ~(SIGNALED | SIG_PENDING | P_STOP);
sigemptyset(&rpc->p_pending);
rpc->p_reg.retreg = 0; /* child sees pid = 0 to know it is child */
@@ -103,9 +103,9 @@ message *m_ptr; /* pointer to request message */
#else
pmmu_init_proc(rp);
#endif
old_flags = rp->p_flags; /* save the previous value of the flags */
rp->p_flags &= ~NO_MAP;
if (old_flags != 0 && rp->p_flags == 0) lock_ready(rp);
old_flags = rp->p_rts_flags; /* save the previous value of the flags */
rp->p_rts_flags &= ~NO_MAP;
if (old_flags != 0 && rp->p_rts_flags == 0) lock_ready(rp);
return(OK);
}
@@ -151,8 +151,8 @@ register message *m_ptr; /* pointer to request message */
(LDT_SIZE - EXTRA_LDT_INDEX) * sizeof(rp->p_ldt[0]));
#endif
rp->p_reg.pc = (reg_t) m_ptr->PR_IP_PTR; /* set pc */
rp->p_flags &= ~RECEIVING; /* PM does not reply to EXEC call */
if (rp->p_flags == 0) lock_ready(rp);
rp->p_rts_flags &= ~RECEIVING; /* PM does not reply to EXEC call */
if (rp->p_rts_flags == 0) lock_ready(rp);
/* Save command name for debugging, ps(1) output, etc. */
phys_name = numap_local(m_ptr->m_source, (vir_bytes) m_ptr->PR_NAME_PTR,

View File

@@ -33,11 +33,11 @@ message *m_ptr; /* pointer to request message */
/* Find the next process with pending signals. */
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
if (rp->p_flags & SIGNALED) {
if (rp->p_rts_flags & SIGNALED) {
m_ptr->SIG_PROC = rp->p_nr;
m_ptr->SIG_MAP = rp->p_pending;
sigemptyset(&rp->p_pending); /* ball is in PM's court */
rp->p_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
rp->p_rts_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
return(OK);
}
}
@@ -60,8 +60,8 @@ message *m_ptr; /* pointer to request message */
if (isemptyp(rp)) return(EINVAL); /* process already dead? */
/* PM has finished one kernel signal. Perhaps process is ready now? */
if (! (rp->p_flags & SIGNALED)) /* new signal arrived */
if ((rp->p_flags &= ~SIG_PENDING) == 0) /* remove pending flag */
if (! (rp->p_rts_flags & SIGNALED)) /* new signal arrived */
if ((rp->p_rts_flags &= ~SIG_PENDING)==0) /* remove pending flag */
lock_ready(rp); /* ready if no flags */
return(OK);
}

View File

@@ -51,8 +51,8 @@ register message *m_ptr;
if (isemptyp(rp)) return(EIO);
switch (tr_request) {
case T_STOP: /* stop process */
if (rp->p_flags == 0) lock_unready(rp);
rp->p_flags |= P_STOP;
if (rp->p_rts_flags == 0) lock_unready(rp);
rp->p_rts_flags |= P_STOP;
rp->p_reg.psw &= ~TRACEBIT; /* clear trace bit */
return(OK);
@@ -120,15 +120,15 @@ register message *m_ptr;
break;
case T_RESUME: /* resume execution */
rp->p_flags &= ~P_STOP;
if (rp->p_flags == 0) lock_ready(rp);
rp->p_rts_flags &= ~P_STOP;
if (rp->p_rts_flags == 0) lock_ready(rp);
tr_data = 0;
break;
case T_STEP: /* set trace bit */
rp->p_reg.psw |= TRACEBIT;
rp->p_flags &= ~P_STOP;
if (rp->p_flags == 0) lock_ready(rp);
rp->p_rts_flags &= ~P_STOP;
if (rp->p_rts_flags == 0) lock_ready(rp);
tr_data = 0;
break;