Re: scheduler policy

Mike Kravetz (kravetz@us.ibm.com)
Thu, 13 Sep 2001 21:14:31 -0700


On Thu, Sep 13, 2001 at 09:27:56PM -0500, shreenivasa H V wrote:
> Hi,
>
> In process scheduling, when an epoch ends because of the current process
> completing its time quantum (and all the runnable ones having finished their
> respective quantums), at the start of the new epoch, will the current running
> process retain the cpu (assuming all the runnable ones are of the same
> priority)?

Short answer, for UP kernels yes.

If all the tasks on the runqueue have the same priority (nice value),
then they will all (almost) have the same goodness value at the start
of the new epoch. However, tasks with the same memory map as the
currently running task will get their goodness value boosted by 1.
The next task to run will be the first one found that has the same
memory map as the currently running task. The check for 'still_running'
ensures that the the currently running task will be found first.

Not sure if this is by design, but this is what the code does.

Also, note that this is only true for UP kernels. In SMP, there
are other factors to consider and a level of unpredictability
due to racing with other CPUs as a result of dropping the runqueue
lock during the 'recalculate' operation.

-- 
Mike Kravetz                                  kravetz@us.ibm.com
IBM Linux Technology Center       (we're not at Sequent anymore)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/