linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Q: 2.4 Scheduler
@ 2002-03-18 11:16 Anders Peter Fugmann
  2002-03-18 13:24 ` Rik van Riel
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Peter Fugmann @ 2002-03-18 11:16 UTC (permalink / raw)
  To: linux-kernel

Hi.

I have some specific questions concering the implementation of the 
scheduler in 2.4.18, which I hope you would please answer for me.

Question #1:
Has anyone documented the functionality of the current scheduler? It
seems that the algorithm used is very sparse explained (although very
easy to understand by looking at the code), and the comments in the
code does not always what the purpose of a function is, but rather how
it works.

Question #2:
In the schedule function, a 'goodness' value is calculated for all
processes, and the maximum is remembered. If this value is zero, tasks
gets a new quantum. The question here is which tasks. Take a look at the
code below. (shed.c, 617)

/* Do we need to re-calculate counters? */
if (unlikely(!c)) {
	struct task_struct *p;

	spin_unlock_irq(&runqueue_lock);
	read_lock(&tasklist_lock);
	for_each_task(p)
		p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice);
	read_unlock(&tasklist_lock);
	spin_lock_irq(&runqueue_lock);
	goto repeat_schedule;
}

What I do not understand here is the 'for_all_tasks'. Its defined in
sched.h, line 870:

#define for_each_task(p) \
	for (p = &init_task ; (p = p->next_task) != &init_task ; )

Would someone please explain the structure of this - Its very hard to
see what this list consists of. Also if anyone has the time to give some 
more general information on 'struct task' I would be happy - It's a big 
structure, and it's hard to track down where the structure is modified, 
and why.


Question #3:
What is the main purpose of 'reschedule_idle.'? In the UP case, its
all about removing the current task from the CPU, but a more detailed
explanation would be nice. Of course I'm interested in the SMP case.

I hope that some of you would be so kind as to spend some time to
answer these questions.  The reason for me asking is, that I'm trying
to document the scheduler (from a theoretical point of view). I also
plan to describe the works of Ingo's O(1) scheduler in 2.5, but I
haven't started looking at that yet.

Thanks in advance
Anders Fugmann


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q: 2.4 Scheduler
  2002-03-18 11:16 Q: 2.4 Scheduler Anders Peter Fugmann
@ 2002-03-18 13:24 ` Rik van Riel
  0 siblings, 0 replies; 2+ messages in thread
From: Rik van Riel @ 2002-03-18 13:24 UTC (permalink / raw)
  To: Anders Peter Fugmann; +Cc: linux-kernel

On Mon, 18 Mar 2002, Anders Peter Fugmann wrote:

> I have some specific questions concering the implementation of the
> scheduler in 2.4.18, which I hope you would please answer for me.
>
> Question #1:
> Has anyone documented the functionality of the current scheduler?

Yes.

There is text about the scheduler in O'Reilly's
"understanding the linux kernel" as well as in
my "kernel tour" lecture.

You can get the latter from http://surriel.com/lectures/

regards,

Rik
-- 
<insert bitkeeper endorsement here>

http://www.surriel.com/		http://distro.conectiva.com/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-18 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18 11:16 Q: 2.4 Scheduler Anders Peter Fugmann
2002-03-18 13:24 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).