New scheduling code in kernel. Work in progress.
Round-robin within one priority queue works fine. Ageing algorithm to be done.
This commit is contained in:
@@ -32,7 +32,7 @@ message *m_ptr; /* pointer to request message */
|
||||
/* PM has finished one kernel signal. Perhaps process is ready now? */
|
||||
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 */
|
||||
lock_enqueue(rp); /* ready if no flags */
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ register message *m_ptr; /* pointer to request message */
|
||||
#endif
|
||||
rp->p_reg.pc = (reg_t) m_ptr->PR_IP_PTR; /* set pc */
|
||||
rp->p_rts_flags &= ~RECEIVING; /* PM does not reply to EXEC call */
|
||||
if (rp->p_rts_flags == 0) lock_ready(rp);
|
||||
if (rp->p_rts_flags == 0) lock_enqueue(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,
|
||||
|
||||
@@ -55,7 +55,7 @@ register struct proc *rc; /* slot of process to clean up */
|
||||
reset_timer(&priv(rc)->s_alarm_timer);
|
||||
|
||||
/* Make sure that the exiting process is no longer scheduled. */
|
||||
if (rc->p_rts_flags == 0) lock_unready(rc);
|
||||
if (rc->p_rts_flags == 0) lock_dequeue(rc);
|
||||
|
||||
/* If the process being terminated happens to be queued trying to send a
|
||||
* message (e.g., the process was killed by a signal, rather than it doing
|
||||
|
||||
@@ -51,6 +51,9 @@ register message *m_ptr; /* pointer to request message */
|
||||
rpc->p_user_time = 0; /* set all the accounting times to 0 */
|
||||
rpc->p_sys_time = 0;
|
||||
|
||||
rpc->p_sched_ticks /= 2; /* parent and child have to share quantum */
|
||||
rpp->p_sched_ticks /= 2;
|
||||
|
||||
/* If the parent is a privileged process, take away the privileges from the
|
||||
* child process and inhibit it from running by setting the NO_PRIV flag.
|
||||
* The caller should explicitely set the new privileges before executing.
|
||||
|
||||
@@ -42,7 +42,7 @@ message *m_ptr; /* pointer to request message */
|
||||
#endif
|
||||
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);
|
||||
if (old_flags != 0 && rp->p_rts_flags == 0) lock_enqueue(rp);
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ PUBLIC int do_nice(message *m_ptr)
|
||||
* queue if it is runnable.
|
||||
*/
|
||||
rp = proc_addr(proc_nr);
|
||||
lock_unready(rp);
|
||||
lock_dequeue(rp);
|
||||
rp->p_max_priority = rp->p_priority = new_q;
|
||||
if (! rp->p_rts_flags) lock_ready(rp);
|
||||
if (! rp->p_rts_flags) lock_enqueue(rp);
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ message *m_ptr; /* pointer to request message */
|
||||
/* Done. Privileges have been set. Allow process to run again. */
|
||||
old_flags = rp->p_rts_flags; /* save value of the flags */
|
||||
rp->p_rts_flags &= ~NO_PRIV;
|
||||
if (old_flags != 0 && rp->p_rts_flags == 0) lock_ready(rp);
|
||||
if (old_flags != 0 && rp->p_rts_flags == 0) lock_enqueue(rp);
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ register message *m_ptr;
|
||||
if (isemptyp(rp)) return(EIO);
|
||||
switch (tr_request) {
|
||||
case T_STOP: /* stop process */
|
||||
if (rp->p_rts_flags == 0) lock_unready(rp);
|
||||
if (rp->p_rts_flags == 0) lock_dequeue(rp);
|
||||
rp->p_rts_flags |= P_STOP;
|
||||
rp->p_reg.psw &= ~TRACEBIT; /* clear trace bit */
|
||||
return(OK);
|
||||
@@ -126,14 +126,14 @@ register message *m_ptr;
|
||||
|
||||
case T_RESUME: /* resume execution */
|
||||
rp->p_rts_flags &= ~P_STOP;
|
||||
if (rp->p_rts_flags == 0) lock_ready(rp);
|
||||
if (rp->p_rts_flags == 0) lock_enqueue(rp);
|
||||
m_ptr->CTL_DATA = 0;
|
||||
break;
|
||||
|
||||
case T_STEP: /* set trace bit */
|
||||
rp->p_reg.psw |= TRACEBIT;
|
||||
rp->p_rts_flags &= ~P_STOP;
|
||||
if (rp->p_rts_flags == 0) lock_ready(rp);
|
||||
if (rp->p_rts_flags == 0) lock_enqueue(rp);
|
||||
m_ptr->CTL_DATA = 0;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user